contextmenu

WPF MenuItem IsChecked Binding not working

匿名 (未验证) 提交于 2019-12-03 08:44:33
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Anyone know why the menu item binding does not work ? <ToggleButton Name="toggleButton" Checked="checkBoxPublish_Checked" > <ToggleButton.Resources> <converters:BooleanToHiddenVisibility x:Key="boolToVis"/> </ToggleButton.Resources> <Grid> <Image Height="auto" HorizontalAlignment="Left" Margin="5" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="auto" /> <Viewbox > <TextBlock Text="Blocked" Opacity="0.7" Foreground="Red" Visibility="{Binding Path=IsChecked, ElementName=toggleButton, Converter={StaticResource boolToVis}}"/> <

NSWindow - Right click menu

独自空忆成欢 提交于 2019-12-03 08:23:29
Is there any way to show a menu when a NSWindow is right-clicked? lbrndnr Rightclick on a view in the window and you will find a property called "menu". Connect this menu property with the menu which should be shown after a right click. Yes. NSWindow inherits from NSResponder , which has handy methods like -rightMouseDown: . edit Actually a better way to do it might be to use a custom NSView subclass for the window's contentView , and override -menuForEvent: (a method on NSView ) to return your right-click menu with the passed NSEvent is a right-click event. 来源: https://stackoverflow.com

Is there any way to change the Context Menu of a Web browser using Wpf (C#)

风格不统一 提交于 2019-12-03 08:04:37
I would to change the menuitems in the default context menu provided in the Web Browser Control. I have already tried: webbrowser.contextmenu = mycontextmenu. Nothing changed. Is there a way to do this? Answer - YES. There is a setting in the webbrowser control for: .IsWebBrowserContextMenuEnabled = false; Setting this to false disables the IE contextmenu, allowing whichever one you set to rule the roots. Simples.. The short answer is yes. See this article on codeproject . Here is another (shorter) article on codeproject The short answer is no. See this thread for more details. I'm trying to

context menu based on NSTableViewCell

╄→гoц情女王★ 提交于 2019-12-03 07:38:05
问题 i would like to place a context menu onto a NSTableView . this part is done. what i would liek to do is to show different menu entries based on the content of the right clicked cell, and do NOT show the context menu for specific columns. this is: column 0, and 1 no context menu all other cells should have the context menu like this: first entry: "delete " samerow.column1.value second entry: "save " samecolumn.headertext hope the question is clear.. thanks -EDIT- the one on the right is how

Unable to add item in Finder's contextual menu using services in Cocoa

眉间皱痕 提交于 2019-12-03 07:33:23
问题 I would like to add an item in my Finder's contextual menu whenever I right-click on files or folders, and this menu being linked to a method of my Cocoa app. I am following CocoaDev's example and Apple's documentation, but I can't get the service being displayed. Here is my .h #import <Cocoa/Cocoa.h> @interface AppDelegate : NSObject <NSApplicationDelegate,NSObject> @property (assign) IBOutlet NSWindow *window; -(void)IClicked:(NSPasteboard *)pboard userData:(NSString *)data error:(NSString

WPF Submenu for context menu

£可爱£侵袭症+ 提交于 2019-12-03 07:29:36
If the Context menu is "hardcoded" in xaml, then it is easy to add submenus. For example: <ContextMenu> <MenuItem Header="Comm1" Command="{Binding Blabla1}"> <MenuItem Header="SubComm1" Command="{Binding Blabla2}"></MenuItem> </MenuItem> <MenuItem Command="Comm2"></MenuItem> <MenuItem Command="Comm3"></MenuItem> </ContextMenu> This means, that the ContextMenu has three elements (Comm1, Comm2 and Comm3) and Comm1 has submenu SubComm1. I have made my ContextMenu a bit more flexible: <ContextMenu ItemsSource="{Binding ContextMenuItemsSource}"> <ContextMenu.ItemContainerStyle> <Style TargetType=

How can I get the element that was right-clicked via a Google Chrome context menu?

我怕爱的太早我们不能终老 提交于 2019-12-03 06:23:54
I am creating a context menu item in Google chrome like so: chrome.contextMenus.create({ "title":"My Context Menu Item", "contexts":["editable"], "onclick": onClick }); The onClick callback receives two arguments: an OnClickInfo object and a tab object. Neither object appears to contain a reference to the DOM element that was right-clicked when invoking the context menu. I have console.logged both of these objects but don't see any reference to the targeted element anywhere. The desired outcome: user right-clicks an editable element user clicks my context menu item within the onClick callback,

WPF ListboxItem and ContextMenu

匿名 (未验证) 提交于 2019-12-03 02:59:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have code like this: <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Vertical" ContextMenuService.ShowOnDisabled="True"> <StackPanel.ContextMenu> <ContextMenu> <MenuItem Command="Delete" Click="DeleteEvent"> </MenuItem> </ContextMenu> </StackPanel.ContextMenu> <TextBlock Text="{Binding EventName}"> </TextBlock> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> Unfortunately It doesn't work. My context menu is disabled (it is displaying but I cannot click it because it's disabled). I've read that this problem is related

Context Menu for XAML Treeviewitem (Distinguished by different attributes)

牧云@^-^@ 提交于 2019-12-03 02:28:35
In XAML, how do you define a context menu for treeviewitems that are distinguished by different attributes? Mr. T. XAML <TreeView Name="SolutionTree" BorderThickness="0" SelectedItemChanged="SolutionTree_SelectedItemChanged" > <TreeView.Resources> <ContextMenu x:Key ="SolutionContext" StaysOpen="true"> <MenuItem Header="Add..." Click="AddFilesToFolder_Click"/> <MenuItem Header="Rename"/> </ContextMenu> <ContextMenu x:Key="FolderContext" StaysOpen="true"> <MenuItem Header="Add..." Click="AddFilesToFolder_Click"/> <MenuItem Header="Rename"/> <MenuItem Header="Remove"/> <Separator/> <MenuItem

ElementName Binding from MenuItem in ContextMenu

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Has anybody else noticed that Bindings with ElementName do not resolve correctly for MenuItem objects that are contained within ContextMenu objects? Check out this sample: All of the bindings work great except for the bindings contained within the ContextMenu. They print an error to the Output window during runtime. Any one know of any work arounds? What's going on here? 回答1: I found a much simpler solution. In the code behind for the UserControl: NameScope.SetNameScope(contextMenu, NameScope.GetNameScope(this)); 回答2: Here's another xaml