menuitem

WPF - Command in a MenuItem in a DataTemplate

I have a DataTemplate containing an Image. To the Image I added a ContextMenu with a MenuItem. To the MenuItem I associated a command. I then handle the command in the view using the DataTemplate. In the CanExecute handler I have e.CanExecute = true. But the Executed handler is never executed. If I remove the Command assignment the Men...

Change Width of Each Asp Menu Item

I would like to do something similar to the code in the link below (but other solutions are gratefully accepted), but instead of changing the background color for menu items, I would like to change the width. Specifically, I would like the first menuitem to have a width of 30 px and all other menuitems a width of 200 px. http://stackov...

How can I prevent a main menu item with sub items from being clickable in Wordpress?

Here is my site: http://wake9.com/blogs/norcal-merced-wakesurfing-competition-2009/. Notice the menu item "Photos and Results". Hover over it and you will see sub menu items. I want to be able to click on the sub-menu items but the main menu item shouldn't be a page or be clickable. The only way i could get this item on the menu was to ...

WPF MenuItem children not showing

Hi, I am using an ObjectDataProvider and a DataTemplate to populate a MenuItem inside my Menu bar. (WPF, C#/XAML) See snipet below. Result: The top menu item appears, when i click on it, the wrapping menu item (the one with the bound header text) appears along with the little arrow indicating the presence of children but hovering or cli...

Is it possible to toggle a menu from keyboard input?

I'm building a dashboard'ish application for a special purpose hardware that has physical buttons that are bound to F1-F10, Up, Down, Backspace, Enter. The application consists of a few views (implemented using the MVVM-pattern) and most of the user interaction are done with menus that are aligned near the physical buttons. I'm trying to...

How would you make a Status Item show or Hide a window when clicked?

How would make a Status Item when the actually button is clicked in the Menu Bar not in a drop down menu show or hide a window? Sorry if this is a bit vague. ...

WPF ContextMenu Style structure

Hello, I would like to restyle a context menu, but I have a question about how to structure my Xaml. In my application resources, I have something like this: <ControlTemplate TargetType="MenuItem" x:Key="MenuItemTemplate"> ... </ControlTemplate> <ControlTemplate TargetType="ContextMenu" x:Key="ContextMenuTemplate"> <ControlTe...

C#: How to detect who is the caller of a context menu's menu item when linked to two different objects?

C#: How to detect who is the caller of a context menu's menu item when linked to two different objects? I have two labels, lblOn and lblOff. I am linking 'one' contextmenu to both labels to discard having to make two of the same. How would I go upon finding out which label object called the contextmenu.menuitem? That way the clicked o...

Binding TabControl.Items to MenuItem

I'm using a TabControl as my main workspace in an application, and I'd like to add a "Window" menu item that lists the headers of open tabs. The active (i.e. - focused) tab should be checked. I've tried using an ItemsTemplate as follows: <MenuItem Header="_Window" ItemsSource="{Binding ElementName=ux_workspace, Path=Items}...

WPF - Left align items in an itemspresenter?

I've got this bit of code in one of my control templates for a SplitButton I'm working on: <Popup x:Name="PART_Popup" AllowsTransparency="True" Grid.Row="1" IsOpen="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" Placement="Bottom" PopupAnimation="{DynamicRe...

How do get menu to open to the left in WPF?

I have a menu (with menuitems) in WPF. Unfortunately when I click on the menu heading it opens the menu to the right. The problem is that there is stuff on the right that I don't want it to overlap. How do I tell WPF to open the menu to the left? Do I need to do a control template? (control templates seem so heavy handed for such bas...

Bind ContextMenu's MenuItem visibility to ListView selection

I have a user control with a ListView containing simple items from an ObservableCollection. I would like the ContextMenu of that ListView to contain items depending on what's selected in the ListView. If no item is selected, some MenuItems should not be visible. My converter isn't even called when I open the ContextMenu. The binding se...

When user clicks on icon area of MenuItem, DelegateCommand does not fire.

If you use the DelegateCommand in the MVVM Template and build menus dynamically as in the code below, then the DelegateCommand will not fire when the user clicks on the icon area on the MenuItem. Is there anyway to either fix this or make the icon area (to the left of the header) disappear? MainView.xaml: <Window x:Class="TestMenuMvvm...

How can I hide the space to the left of menu items in XAML menus?

Is there a way that I can suppress the space to the left of a MenuItem's text? Something like LeftAreaVisible="Collapsed" (pseudo-code) below: <Menu DockPanel.Dock="Top"> <MenuItem LeftAreaVisible="Collapsed" Header="MVVM" ItemsSource="{Binding MvvmMenuPageItemViewModels}" ItemTemplate="{StaticResou...

How can I bind an ObservableCollection of ViewModels to a MenuItem?

When I bind Menu Items with an ObservableCollection, only the "inner" area of the MenuItem is clickable: In my View I have this menu: <Menu> <MenuItem Header="Options" ItemsSource="{Binding ManageMenuPageItemViewModels}" ItemTemplate="{StaticResource MainMenuTemplate}"/> </Menu> Then I bind it with this D...

WPF - How to find item clicked on in menu handler method?

How can the handler method of a WPF menu item determine which item in a ListView was clicked on? Edit: The menu is a context menu which has been set for the ListView. The problem is to find which ListView item has been clicked on when the context menu item is selected. ...

Problem with icon color in .NET Windows Forms menu

I'm using VS2008 and I'm creating a Windows Forms project. The form has a menu of MenuStrip class, and the items are (surprise, surprise) ToolStripMenuItem objects. I want to add pretty icons from the FamFamFam Silk icon set. All is nice and fine, until I got to the "copy" icon. You can see it here (warning! 1MB image!) under the name "...

Change Menu Items Programmatically From Eclipse Plugin

I would like to be able to completely remove menu items upon startup of my eclipse plugin application. What I want to do is be able to add these menu items later depending on business logic based off of the user's actions. Is there a way to do this? I've looked at using contributions, but I feel like it's not going to be exactly what I w...

Getting the text of the menu item that was clicked?

Hi, I have a context menu that's bound to a list of strings so that each menuitem's text is an element of the string list. Each menuitem is set to the same event handler. What I'm trying to do is to figure out is which menu item was clicked when when the event handler is called. I would think it would be pretty straight forward to do,...

Get click event on a menuitem with subitems (C#)

I am creating a contextmenu that should contain a listing of all folders, subfolders, and files in a chosen folder. I want the menu to open the files and folders when they are clicked, but the click event doesn't register if the menuitem has subitems. void Foo(string Title) { MenuItem = new MenuItem(Title); MenuItem.Click += new...