menuitem

Bind ContextMenu's MenuItem visibility to ListView selection

99封情书 提交于 2019-12-04 05:37:43
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 seems to be wrong, I find this in the output window: System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=listView'. BindingExpression:Path=SelectedItem; DataItem=null; target element is 'MenuItem' (Name=''); target property is

Enable/disable menu item in Eclipse plugin

青春壹個敷衍的年華 提交于 2019-12-04 05:24:05
I've made a pop-up menu with one menu item, I want to enable it only when I do a right click on a tree item of a certain class type otherwise disable it. How can I achieve this? You can add a handler that uses activeWhen and associate it with that menu's command id. Here is a handler that makes a command active only when the current selection is not empty, and the selection is an item that can be adapted to an object of type Widget : <extension point="org.eclipse.ui.handlers"> <handler class="com.myproject.handlers.ExportWidgetHandler" commandId="com.myproject.commands.exportWidget">

WPF MenuItem with Image and IsCheckable set

雨燕双飞 提交于 2019-12-04 05:22:54
I've noticed that if you set IsCheckable and have an image for a MenuItem, when the item is checked, the image goes away. Is is possible to get it to work similarly to the old .Net 2.0 so that when it's checked, the image has a border around it? Thanks Paul. You would need to restyle the MenuItems to achieve that. You can take the default Styles from here , for say Aero, and pull out the Style (and relevant brushes) for the MenuItem. Once you have that, you can customize it all you want. For MenuItem, you can actually just redefine the SubmenuItemTemplateKey and SubmenuHeaderTemplateKey

How to give color to menu items for Navigation drawer?

做~自己de王妃 提交于 2019-12-04 04:37:13
I was creating Navigation Drawer and i saw playtore have colored menu icons i want to know how can i do this. I tried to apply colors by colorFilter on menu icons but app force closes This is my code <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:id="@+id/grp1" android:checkableBehavior="single"> <item android:id="@+id/navigation_songs" android:checked="true" android:icon="@drawable/ic_audiotrack_white_24dp" android:title="@string/songs" /> <item android:id="@+id/navigation_albums" android:icon="@drawable/ic_album_white

ASP.Net Menu Control - Horizontal - Not Showing Sub Options

只谈情不闲聊 提交于 2019-12-04 04:21:12
问题 I am trying to use the ASP:Menu control. It is rather simple. I want it Horizontal. Each of those first level items will have Sub items. I can get it Horizontal and when I hover over the Instant Reports or the Configurable Reports choice it seems to pop down a div or something but it is empty. I have tried formatting and everything I can think of as well as find on the internet. What am I doing wrong? <asp:Menu ID="mnuChoices" runat="server" Orientation="Horizontal" DataSourceID="dsSiteMap">

Underline menu item in navigation drawer list

限于喜欢 提交于 2019-12-04 04:01:00
问题 How do you underline menu items in navigation drawer? expectation : reality : @menu/activity_navigation_drawer: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:checkableBehavior="single"> <item android:id="@+id/nav_open_account" android:title="@string/na_navigate_open_account" /> <item android:id="@+id/nav_login" android:title="@string/na_navigate_login" /> <item android:id="@+id/nav_stock_signals" android:title="@string

Checkable MenuItem With Sub Menus

我与影子孤独终老i 提交于 2019-12-04 03:18:12
Can you have submenus with the top level set to checkable in WPF? I can't seem to get this to work. <Window.ContextMenu> <ContextMenu> <MenuItem Header="Top Level 1" IsCheckable="True" IsChecked="True"> <MenuItem Header="Sub Level" /> <MenuItem Header="Sub Level" /> </MenuItem> <MenuItem Header="Top Level 2"> <MenuItem Header="Sub Level" /> <MenuItem Header="Sub Level" /> </MenuItem> </ContextMenu> </Window.ContextMenu> Top Level 1 is checkable, but the sub levels don't appear. Any thoughts? If you dig into MenuItem 's ControlTemplate , you will see that it uses different templates depending

Horizontal Menu with Horizontal SubMenu in WPF

断了今生、忘了曾经 提交于 2019-12-03 21:13:51
I have been struggling with the WPF Menu and I simply cannot achieve what I want to. I tried changing default styling on the Menu and MenuItem control, but this turned out terrible. I then tried styling it by making use of control templates, however, I think I came to realization that my WPF skill just aren't there yet. Here is a picture of my desired result: Is there anyone that can maybe point me in the right direction? Or maybe assist me with some xaml that will give my desired result? You can set ItemsPanel with horizontal orientation, like this: <Menu.ItemsPanel> <ItemsPanelTemplate>

MenuItem keyboard shortcuts in 'pure' MVVM?

て烟熏妆下的殇ゞ 提交于 2019-12-03 15:59:51
All menus/contextmenus/toolbars I use in wpf are declared in ViewModel code pretty much like this: MenuService.Add( new MenuItem() { Header = "DoStuff", Command = new relayCommand( DoStuff, () => CanDoStuffExecute() ) // some more properties like parent item/image/... } ); The MenuService provides a single binding point which is a hierarchical list of MenuItem and gets bound to the actual Menu's ItemsSource in xaml. This works very well and now I'd like to add keyboard shortcuts in the same convenient way. Ideally MenuItem would get a property of type System.Windows.Input.KeyGesture so I can

Android: how to make transition animations on toolbar's menu icons?

筅森魡賤 提交于 2019-12-03 15:51:40
If you use the last version of WhatsApp you will notice that if you long click a textbox in a chat, then the menu icons on the toolbar will change with a nice rotating animation. How could I reproduce that effect? I know I should invalidate the menu but not how to make the animation. Use a Toolbar . Wait for the Toolbar to have its items inflated. Find the item in question Animate the item Example: mToolbar = (Toolbar) findViewById(R.id.toolbar); mToolbar.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { @Override public void onLayoutChange(View v, int left, int top, int right, int