Hi
I want to disable some items of the textbox like "Right to left reading order". I don't like these, but I do not found an explication why these are there and if is correct disable/remove them.
You can see here a little image开发者_Go百科 with the items that I want avoid.
http://www.imageupload.org/?d=96631C971
Any suggestions please.
While it's not possible to disable items from the default context menu, you can create a new one and customize the items for the textbox like this.
var contextMenu = new ContextMenu();
contextMenu.MenuItems.Add(new MenuItem("Copy", (s, ea) => textBox1.Copy()));
contextMenu.MenuItems.Add(new MenuItem("Paste", (s, ea) => textBox1.Paste()));
contextMenu.MenuItems.Add(new MenuItem("Undo", (s, ea) => textBox1.Undo()));
contextMenu.MenuItems.Add(new MenuItem("Select All", (s, ea) => textBox1.SelectAll()));
textBox1.ContextMenu = contextMenu;
Note: use contextMenu.MenuItems.Add(new MenuItem("-"))
for separators.
精彩评论