This example demonstrates how to create a custom button and display it in the grid's data navigator.
C#private void Form1_Load(object sender, EventArgs e) {
// ...
gridControl1.UseEmbeddedNavigator = true;
gridControl1.EmbeddedNavigator.ButtonClick += new DevExpress.XtraEditors.NavigatorButtonClickEventHandler(gridControl1_EmbeddedNavigator_ButtonClick);
gridControl1.EmbeddedNavigator.Buttons.ImageList = imageCollection1;
DevExpress.XtraEditors.NavigatorCustomButton button = gridControl1.EmbeddedNavigator.Buttons.CustomButtons.Add();
button.Tag = "copy";
button.Hint = "Copy to clipboard";
button.ImageIndex = 0;
}
private void gridControl1_EmbeddedNavigator_ButtonClick(object sender, DevExpress.XtraEditors.NavigatorButtonClickEventArgs e) {
if("copy".Equals(e.Button.Tag)) {
if(gridControl1.FocusedView != null) {
gridControl1.FocusedView.CopyToClipboard();
MessageBox.Show("Selected data has been copied to the Clipboard");
e.Handled = true;
}
}
}
Files to Review
Documentation
Does this example address your development requirements/objectives?
(you will be redirected to DevExpress.com to submit your response)