contextmenu

context menu parent?

北城以北 提交于 2019-11-29 06:12:25
Hi I added a context menu on label (c#, winforms). my context menu having 3 child items and i want to display label text when i click on any one of context menu items. thanks in advance The ContextMenuStrip control has a SourceControl property, that will have a reference to the control that opened it. You can use that to extract the text from the control: private void MenuStripItem_Click(object sender, EventArgs e) { ToolStripItem item = (sender as ToolStripItem); if (item != null) { ContextMenuStrip owner = item.Owner as ContextMenuStrip; if (owner != null) { MessageBox.Show(owner

Adding a TrackBar control to a ContextMenu

南楼画角 提交于 2019-11-29 04:56:55
Is it possible to add a TrackBar control to a ContextMenu? So when I right click, my ContextMenu will drop down and a TrackBar will appear as a menu item? If your context menu is a ContexMenuStrip , you can create an item in this way: [ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.MenuStrip | ToolStripItemDesignerAvailability.ContextMenuStrip)] public class TrackBarMenuItem : ToolStripControlHost { private TrackBar trackBar; public TrackBarMenuItem():base(new TrackBar()) { this.trackBar = this.Control as TrackBar; } // Add properties, events etc. you want to expose... }

Adding the same context menu to multiple activities

折月煮酒 提交于 2019-11-29 04:05:48
I'm trying to figure out how to include common pieces of code in multiple activities. More specifically, I have a context menu that I would like to include in several activities. I saw this, but just don't understand how to extend to multiple activities. http://developer.android.com/guide/topics/ui/menus.html I have this set up as Menu.java public class Menu extends Activity{ // bottom menus public static final int Menu1 = 1; public static final int Menu2 = 2; public static final int Menu3 = 3; public static final int Menu4 = 4; public static final int Menu5 = 5; public static final int Menu6

How to display context menu for treeview item in a hierarchial data template in wpf

ぃ、小莉子 提交于 2019-11-29 03:57:40
How to display context menu for tree view item in wpf using the hierarchical data template? How to display context menu only for CountryTemplate: <HierarchicalDataTemplate x:Key="DispTemplate"> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Path=Label}" Style="{StaticResource TreeTextStyle}" ToolTip="{Binding Path=Description}" Tag="{Binding Path=Tag}"> </TextBlock> </StackPanel> </HierarchicalDataTemplate> <HierarchicalDataTemplate x:Key="BuildingTemplate" ItemsSource="{Binding Path=Building}" ItemTemplate="{StaticResource BuildingTemplate}"> <StackPanel Orientation=

Column-specific context menu for Primefaces DataTable

时间秒杀一切 提交于 2019-11-29 03:08:55
问题 How can I define context menu for each column differently in Primefaces datatable? Putting <p:contextMenu> inside <p:column> does not work properly. I want context menu to be different depending on which column user right-clicked in. This does not work (context menu is created the same for all columns): <p:dataTable value="#{values}" var="value" selectionMode="single" selection="#{selectedValue}" id="table"> <p:column headerText="Col 1"> <h:outputText value="#{value.balance}"> <f

How to disable the default context menu on a text field

一世执手 提交于 2019-11-29 02:27:59
By default the JavaFX TextField has a built in ContextMenu with 'undo', 'copy', 'cut' etc. options. The ComboBox also has the same ContextMenu when it is set as editable (the ComboBox is actually part of the editor which is a TextField ). I want to replace this ContextMenu with a custom one but I'm having a problem with disabling the default one. I have tried consuming the ContextMenu and mouse click events but ComboBox and ComboBox.getEditor() both have a null ContextMenu . Am I missing something? As you have already stated, a call to GetContextMenu() returns null (which is the big clue the

add menu item to default context menu

感情迁移 提交于 2019-11-29 02:04:07
I'd like to add a menu item to the default ContextMenu of a RichTextBox . I could create a new context menu but then I lose the spell check suggestions that show up in the default menu. Is there a way to add an item without re-implementing everything? It's not too tricky to reimplement the RichTextBox context menu with spelling suggestions, Cut, Paste, etc. Hook up the context menu opening event as follows: AddHandler(RichTextBox.ContextMenuOpeningEvent, new ContextMenuEventHandler(RichTextBox_ContextMenuOpening), true); Within the event handler build the context menu as you need. You can

How to add a separator to a WinForms ContextMenu?

混江龙づ霸主 提交于 2019-11-29 01:59:37
问题 Inside my control, I have: ContextMenu = new ContextMenu(); ContextMenu.MenuItems.Add(new MenuItem("&Add Item", onAddSpeaker)); ContextMenu.MenuItems.Add(new MenuItem("&Edit Item", onEditSpeaker)); ContextMenu.MenuItems.Add(new MenuItem("&Delete Item", onDeleteSpeaker)); ContextMenu.MenuItems.Add( ??? ); ContextMenu.MenuItems.Add(new MenuItem("Cancel")); How to add a separation line to this ContextMenu? 回答1: I believe it's just a dash: ContextMenu.MenuItems.Add("-"); 回答2: This works just as

WPF ContextMenu with ItemsSource - how to bind to Command in each item? [duplicate]

夙愿已清 提交于 2019-11-28 23:15:27
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Specify Command for MenuItem in a DataTemplate I have a collection of objects (viewmodels) that represent menu items. Each of them have a command that I would like to execute when a MenuItem is clicked. If I wanted to do the menu statically, I do it like this: <ContextMenu> <MenuItem Header="{Binding Text1}" Command={Binding Command1}> <MenuItem Header="{Binding Text2}" Command={Binding Command2}> </ContextMenu>

Add a Windows Shell context menu entry for a specific extension (not file type)

空扰寡人 提交于 2019-11-28 22:05:33
To add a Windows shell context menu, let's say for .txt files - if the .txt extension in HKEY_CLASSES_ROOT (or in HKEY_CURRENT_USER\Software\Classes , doesn't really matter) has the default value ( file type ) txtfile - you add the command to HKEY_CLASSES_ROOT\txtfile\shell\yourcommand (and the command itself in HKEY_CLASSES_ROOT\txtfile\shell\yourcommand\command , of course) and there you go. However, let's say the .txt extension instead has the default value Notepad++_file . Notepad++_file might be the file type for many other extensions , so if you add the command to HKEY_CLASSES_ROOT