contextmenu

WPF context menu data-bound icon only appears when inspected

时间秒杀一切 提交于 2019-12-11 05:12:47
问题 Within a TreeView 's resources, I have a HierarchicalDataTemplate that also defines the context menu style. The aim is to be able to have programmatically defined MenuItem s specify an icon name as their Tag and then have the front-end display the right icon. <StackPanel.ContextMenu> <ContextMenu ItemsSource="{Binding MenuItems}"> <ContextMenu.Resources> <Style TargetType="{x:Type MenuItem}"> <Setter Property="Icon"> <Setter.Value> <local:StringToIcon IconName="{Binding Tag, RelativeSource=

Chrome extension: create div on text highlight

牧云@^-^@ 提交于 2019-12-11 05:00:20
问题 I'm looking to create a create a chrome extension which gets the currently highlighted text and creates a div just under the text, like the chrome dictionary app. Does anyone know what sort of popup this is, or how it is achieved? Thanks! Tom 回答1: There will be two HTMLs , a popup.html - the view, and a background.html - that will be for routing, calculations, etc., the base functionality of your Extension. As an attempt to answer your question, the way you communicate from one html to other

Silverlight ContextMenu was not found

妖精的绣舞 提交于 2019-12-11 04:02:41
问题 This is what I've got inside a Canvas tag right now. I've been trying to get a right click menu working for ages. <controlsInputToolkit:ContextMenuService.ContextMenu> <controlsInputToolkit:ContextMenu> <controlsInputToolkit:MenuItem Header="Move Up" Click="MoveUp_Click"> <controlsInputToolkit:MenuItem.Icon> <Rectangle Width="16" Height="16" Fill="{StaticResource MoveUpBrush}"/> </controlsInputToolkit:MenuItem.Icon> </controlsInputToolkit:MenuItem> <controlsInputToolkit:MenuItem Header="Move

putting ContextMenu in WPF Styles

末鹿安然 提交于 2019-12-11 03:59:16
问题 I am trying to put ContextMenu in styles with below so that it can be shared by all textboxes. <Grid.Resources> <Style x:Key="Cell" TargetType="TextBox"> <Setter Property="Margin" Value="0"/> <Setter Property="BorderBrush" Value="Black"/> <Setter Property="BorderThickness" Value="0.2"/> <Setter Property="VerticalAlignment" Value="Stretch"/> <Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="MinHeight" Value="30"/> <Setter Property="MinWidth" Value="70"/> <Setter

How to disable context menus with right mouse click in an NSTextField (Cocoa)?

吃可爱长大的小学妹 提交于 2019-12-11 03:57:22
问题 I'm working on a Cocoa application that has editable text fields. These text fields need to accept values but don't need to be spell checked or use any of the other options given in the default context menu. I've read that the easiest way to remove the right click/ opt + click context menu is to override the function: rightMouseDown:(NSEvent *) I've done this in a custom NSTextfield class. This fix blocks the user from right clicking when the text box is enabled and unselected, but as soon as

ListBox.SelectedIndex in ContextMenu event handler

浪子不回头ぞ 提交于 2019-12-11 03:14:38
问题 I have a listbox with context menu. How can I get value of SelectedIndex (SelectedItem) property in ContextMenuItem click event handler? Currently in events Edit_Click and Delete_CLick a value of CarsList.SelectedIndex always is -1. Here my ListBox in XAML: <ListBox Name="CarsList" Style="{StaticResource ListBoxStyle}" Margin="26,0,26,0" Height="380" > <toolkit:ContextMenuService.ContextMenu> <toolkit:ContextMenu Name="ContextMenu" > <toolkit:MenuItem Name="Edit" Header="Edit" Click="Edit

How to change the color of a check mark or 'more' arrow on a WinForms context menu?

醉酒当歌 提交于 2019-12-11 03:14:37
问题 I have a context menu that needs to use a dark background. It uses a check margin and has several sub-menus. The check mark and the arrow indicating a sub-menu are both black and thus hard to see. I can find no way to change the color. (It would seem obvious to me that they ought to use the ForeColor, which we have set to white for the text, but this does not seem to affect the check marks or arrows.) Is there a way to do this? EDIT: We are using images in the image margin as a work-around.

Binding a context menu to a ListBox's Items collection

元气小坏坏 提交于 2019-12-11 02:50:00
问题 I'm trying to create a context menu for a list box which displays elements in the context menu from the list box. I am able to accomplish this by using the following XAML: <Window.Resources> <ContextMenu x:Key="contextMenu" ItemsSource="{Binding Items, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBox}}}" > <ContextMenu.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Content}"/> </DataTemplate> </ContextMenu.ItemTemplate> </ContextMenu> <Style TargetType="{x

how to display an option menu when an activity starts

爱⌒轻易说出口 提交于 2019-12-11 02:33:24
问题 I've activity that i want an option menu to be displayed on. But, i want the option menu to be displayed all the time the activity is displayed. I don't want my users to click (select) the menu button to display it. I want it to be there all the time. How can i do it? thanks 回答1: Activity.openOptionsMenu() . From a design standpoint, I have to agree with Mayra. Wrong approach to begin with. 回答2: If you want options to appear at the bottom of the screen always, don't use the options menu. Just

Catch Right-Click AS3

家住魔仙堡 提交于 2019-12-11 02:28:16
问题 Is it possible to catch a right-click inside of flash (AS3)? No JQuery/JavaScript. I need to pause gameplay when a right-click is caught, so I don't so much want to disable the context-menu as I do just want to tell that a right-click has happened. Is there an EventListener I can add? Any other ideas? UPDATE: I need the event to be triggered as they are actually right clicking, not just after the context-menu has disappeared. 回答1: There are only two ways to capture a right click event: For a