Telerik RadGridView 右键菜单如何设置?
问题:
我想去掉红线框住的部分,希望有会的网友帮助我,谢谢!
解决方法:
默认:
修改:
【利用 ContextMenuOpening 事件,对应你的项目,你要自己修改那判断的字符串(你的中文)】
private void radGridView1_ContextMenuOpening(object sender,Telerik.WinControls.UI.ContextMenuOpeningEventArgs e) { for (int i = 0; i < e.ContextMenu.Items.Count; i++) { String contextMenuText = e.ContextMenu.Items[i].Text; switch (contextMenuText) { case "Conditional Formatting": e.ContextMenu.Items[i].Visibility = Telerik.WinControls.ElementVisibility.Collapsed; e.ContextMenu.Items[i + 1].Visibility = ElementVisibility.Collapsed; break;
case "Hide Column": e.ContextMenu.Items[i].Visibility = Telerik.WinControls.ElementVisibility.Collapsed; break;
case "Pinned state": e.ContextMenu.Items[i].Visibility = Telerik.WinControls.ElementVisibility.Collapsed; break;
case "Best Fit": e.ContextMenu.Items[i].Visibility = Telerik.WinControls.ElementVisibility.Collapsed; break; } } }