我在C#.NET中编程,在我的应用程序中使用XtraGrid控件。
我在我的项目中使用MyXtraGrid (自定义控件)。
现在,我需要重写自定义按钮的EmbeddedNavigator_ButtonClick:
但我不对EmbeddedNavigator_ButtonClick使用覆盖方法
发布于 2012-05-02 07:28:48
EmbeddedNavigator.CustomButtons属性提供对自定义按钮集合的访问。您可以将所有需要的按钮添加到此集合中。要重写嵌入式导航器按钮行为或实现自定义按钮的反应,您应该处理NavigatorBase.ButtonClick事件。下面是一些示例代码:
class MyGridControl : DevExpress.XtraGrid.GridControl {
public MyGridControl() {
EmbeddedNavigator.ButtonClick += EmbeddedNavigator_ButtonClick;
}
//...
void EmbeddedNavigator_ButtonClick(object sender, NavigatorButtonClickEventArgs e) {
if(e.Button.ButtonType == DevExpress.XtraEditors.NavigatorButtonType.Delete) {
// ... your code is here
e.Handled = true; // disable the default processing
}
if(e.Button.ButtonType == DevExpress.XtraEditors.NavigatorButtonType.Custom) {
// ... your code is here
e.Handled = true; // disable the default processing
}
}
}https://stackoverflow.com/questions/10401622
复制相似问题