简体   繁体   English

在树视图节点上处于编辑模式时,如何删除默认的ContextMenu?

[英]How do I remove the default ContextMenu while in edit mode on a treeview node?

While in Edit mode of a treeview node. 在树视图节点的“编辑”模式下。 When someone right clicks a context menu with cut, copy, paste, insert unicode character, among other items appear. 当某人右键单击带有剪切,复制,粘贴,插入Unicode字符的上下文菜单时,将显示其他项。 Cut, copy and paste would be ok but i do not want anything else to appear. 剪切,复制和粘贴可以,但是我不希望出现其他任何情况。

Is there a way to remove some or all of these items? 有没有办法删除部分或全部这些项目?

You could bind the IsEnabled property of the MenuItem to a property form the ViewModel or Code-Behind of the View and change the value of the property in case of WPF: 您可以将MenuItem的IsEnabled属性绑定到ViewModel或View的Code-Behind属性,并在WPF的情况下更改该属性的值:

WinForms scanario: You could use the approach suggested in this MSDN article: http://msdn.microsoft.com/en-us/library/system.windows.forms.contextmenu.sourcecontrol.aspx WinForms scanario:您可以使用此MSDN文章中建议的方法: http : //msdn.microsoft.com/zh-cn/library/system.windows.forms.contextmenu.sourcecontrol.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM