contextmenu

How do you show the Windows Explorer context menu from a C# application?

倾然丶 夕夏残阳落幕 提交于 2019-11-27 18:51:41
I have a file listing in my application and I would like to allow people to right-click on an item and show the Windows Explorer context menu. I'm assuming I would need to use the IContextMenu interface, but I'm not really sure where to start. Rowland Shaw There's a very good tutorial (albeit in C++) about hosting an IContextMenu on Raymond Chen's blog in 11 parts (in order): Initial foray Displaying the context menu Invocation location Key context Handling menu messages Displaying menu help Invoking the default verb Optimizing for the default command Adding custom commands Composite

WPF ContextMenu itemtemplate, menuitem inside menuitem

◇◆丶佛笑我妖孽 提交于 2019-11-27 18:25:31
问题 I have the following xaml: <ContextMenu ItemsSource="{Binding TestItems}"> <ContextMenu.ItemTemplate> <DataTemplate DataType="models:TestItemModel"> <MenuItem IsChecked="{Binding IsSelected}" Header="{Binding Header}" /> </DataTemplate> </ContextMenu.ItemTemplate> </ContextMenu> The TestItemModel class only consists of a IsSelected boolean property and a Header string property. TestItems is a list of TestItemModels. The data is binded to the contextmenu but it is reflected in the UI as a

Adding the same context menu to multiple activities

笑着哭i 提交于 2019-11-27 18:20:18
问题 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 =

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

心不动则不痛 提交于 2019-11-27 18:01:44
问题 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="

Angular 2 right click events?

寵の児 提交于 2019-11-27 17:21:30
问题 I am building an interactive web application with Angular2 and I am looking for a way to capture right clicks on an angular component. I also need to prevent the browser context menu appearing on a right click so I can display my own custom context menu. I know that in angular 1, you had to create a custom directive to capture a right click event. Is this still the case in Angular 2, or is it built in/is there an easier way of doing it? I've had a look through some previous SO questions but

Configuring jstree right-click contextmenu for different node types

耗尽温柔 提交于 2019-11-27 17:02:48
I've seen an example somewhere online showing how to customise the appearance of jstree's right-click context menu (using contextmenu plugin). For example, allow my users to delete "documents" but not "folders" (by hiding the "delete" option from the context menu for folders). Now I can't find that example. Can anyone point me in the right direction? The official documentation didn't really help. Edit: Since I want the default context menu with only one or two minor changes, I'd prefer to not recreate the whole menu (though of course I will if it's the only way). What I'd like to do is

Show context menu when link is long pressed in TextView

柔情痞子 提交于 2019-11-27 16:53:54
问题 I have a TextView with its MovementMethod set to LinkMovementMethod . Text added to the TextView is a combination of normal text and URLs. For URLs, I would like to offer a context menu when the URL is long pressed for doing things such as copying the address. I've had a look at the source for LinkMovementMethod but it doesn't seem to have any long pressed related code I could override. Any ideas on how to go around achieving this? 回答1: You can simply use registerForContextMenu eg: TextView

How to disable the default context menu on a text field

允我心安 提交于 2019-11-27 16:41:56
问题 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

How do I trigger the browser context menu on an element. (As if the user right-clicked)

删除回忆录丶 提交于 2019-11-27 16:04:59
I have the need to trigger the opening of the browser (IE, Firefox, Safari, etc) context-menu via javascript. The problem I am trying to solve, is when an overlaid element is right-clicked, the element below it shows its context menu. So if the top element is a label, when you right click, I need to show the context menu for the input element below. I know how to keep the label's context menu from showing, but I don't know how to open a context menu arbitrarily. Any help is appreciated! Sorry to be the bearer of unfortunate news, but this is impossible to do with Javascript. I don't want to

How to access a control from a ContextMenu menuitem via the visual tree?

て烟熏妆下的殇ゞ 提交于 2019-11-27 15:39:51
This seems to be a pretty popular topic, but... I have the following XAML: <internal:MyCommandObject x:Name="CommandModel"/> <Button DockPanel.Dock="Bottom" Command="{Binding DoAction, ElementName=CommandModel}"> <Button.ContextMenu> <ContextMenu DataContext="{Binding PlacementTarget, RelativeSource={RelativeSource Self}}"> <MenuItem Command="{Binding DoAction, ElementName=CommandModel}"/> </ContextMenu> </Button.ContextMenu> Click Me </Button> Now, MyCommandObject is a control which exposes dynamic commands from its DataContext . You know what's coming next. :) Basically, the button command