How can I get the standard context menu in a RichTextBox, like the one in TextBox (Copy, Paste, IME etc.)? I'd go with a P/Invoke solution if nothing is available out of the box. Or do I really have to follow those strange advices to create a custom menu to get a standard menu (sigh)?
The ContextMenuStrip property of the richtextbox can be assigned to a user designed context menu, Copy/Cut/Paste and just apply the RichTextBox's methods to each of the menu items such as CanUndo, CanCopy, CanPaste to determine the menu item's Enabled property. Using the methods 'Copy,CutandPaste` will be the executed method for the menu item's click event.
Hope this helps,
Best regards,
Tom.
Related
I’m building a user control that has a context menu with several items, and I want the users of that control to be able to append items to that context menu.
I thought of adding an attached property where users can specify menu items, but I couldn’t find a way to easily add these items (e.g. in an ItemsControl container) to the control’s ContextMenu in an MVVM way (i.e. using binding and not code-behind).
Do you have an idea how this can be done?
If you have Dictionary<int,MenuItem> and you will have a place that user can select menus. Then add selected menu items to ContextMenu when your control loaded.
I hope this helps.
In WinForms, I have to quickly set up a list of items that have some text and a dropdown of commands/buttons. This would be easy in XAML (I'm getting spoiled), but I'm not familiar with Winforms.
Do any of the std Winform controls provide this?
Can anyone suggest a 3rd party control??
The image shows a drop-down being shown when hovered.
Thanks
Looks like a normal context menu, so you can probably do this with the ContextMenuStrip component. Call one of its Show() methods when you want to open it.
realy i don't know what i should title this problem, i hope to "WPF UI Related question" is accept able.
consider something like that form who you explore a class diagram in Visual Studio.
you select any class object in window and than right click on it then you select "Properties" menu Item and then a window will pups up that allow you to change selected class object.
or something like Auto Cad. when you draw a line you can right click on it and then select Properties menu item and then with appeared window you can change line's properties (like color of line or any thing like that).
now i want to create an application with an User Interface like these who mentioned on upper lines.
i want to create an UI that i cad draw circle and squares on it (with mouse clicks) and then when i want a "Properties" window will appeared to change objects's properties.
also with this capability that wheeling mouse wheel up-down will results in zoom in/out the screen (like Auto CAD).
finally my question is that is there any kind of frameworks or pre created controls that i can use them for achiving these goals or i have to implement all these my self?
thanks all and sorry for my bad english..
You can use this for your property grid:
WPF Property Grid
for giving zoom capability i use this and for property windows i use this.
thanks to Yogesh...
What controls would be most suitable for creating a complex context menu, similar what you see in Windows Word. Should it be pop up, tooltip, or context menu or a transparent window?
What you think would be the best control to start with?
I'd start with a ContextMenu, since that is the behaviour you want. Unlike a ToolTip that won't automatically disappear after a few seconds, and it is already set up to by a collection of MenuItems.
Been searching everywhere and can't find a way to do this.
I have a menubar across the top of my winforms program. Now it just pops up a normal menuitem menu. I would like to disable that menu and popup a nice looking usercontrol that looks like its the dropdown for that menu item but includes much more customization. A good example would be the gnome menu bar in OpenSuse or the Start Menu in windows vista.
Can anybody point me to a tutorial or help me out in finding a way to do this?
Right now I know that as long as the menuitem has no subitems a menu won't appear, which is what I want to do, but I would like to simulate that menu with my own usercontrol when that menuitem is clicked.
Thanks!!!
I had to add my own trackbar to the toolbar recently which involves deriving from ToolStripControlHost. I imagine that you will need to do something similar as MenuStrip is a derivation of ToolStrip.
This is an MSDN tutorial for using ToolStripControlHost and here is a CodeProject article about adding a custom control to a ToolStripDropDownButton.