menuitem

How to select a Menu Item without closing the Menu?

我的梦境 提交于 2019-11-27 10:56:25
问题 By default when you select an item from a TMainMenu or TPopupMenu etc, the menu closes after it was clicked. I would like to change this behavior so that when I select on a menu item, the menu does not close but remains visible and open at the point it was last clicked, making it easier to select another menu item if desired. Of course, switching focus to another control should hide the menu like normal, but if the focus is still on the menu keep it visible. If this is possible, I would like

How to add submenu items to ActionBar action in code?

痞子三分冷 提交于 2019-11-27 10:31:31
Via xml I can add submenu items to my action in the ActionBar . main_menu.xml: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/menu_new_form" android:icon="@drawable/ic_new_form" android:title="@string/menu_new_form" android:showAsAction="ifRoom|withText"> <menu> <item android:id="@+id/form1" android:icon="@drawable/attachment" android:title="Form 1" android:onClick="onSort" /> <item android:id="@+id/form2" android:icon="@drawable/attachment" android:title="Form 2" android:onClick="onSort" /> </menu> </item> </menu

Android ActionBar MenuItem LowerCase

隐身守侯 提交于 2019-11-27 10:28:29
问题 I want to make MenuItem title in the ActionBar to LowerCase. my menu.xml <item android:id="@+id/register" android:title="Register" android:showAsAction="ifRoom|withText"/> <item android:id="@+id/unregister" android:title="Unregister" android:showAsAction="ifRoom|withText"/> On the ActionBar it sees "REGISTER" and "UNREGISTER", but I want that it sees as "Register" and "Unregister". Is it possible to make first letter upper and next letters lower at MenuItem? And how I can do that? 回答1:

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

雨燕双飞 提交于 2019-11-27 10:10:55
问题 When I bind Menu Items with an ObservableCollection, only the "inner" area of the MenuItem is clickable: alt text http://tanguay.info/web/external/mvvmMenuItems.png In my View I have this menu: <Menu> <MenuItem Header="Options" ItemsSource="{Binding ManageMenuPageItemViewModels}" ItemTemplate="{StaticResource MainMenuTemplate}"/> </Menu> Then I bind it with this DataTemplate : <DataTemplate x:Key="MainMenuTemplate"> <MenuItem Header="{Binding Title}" Command="{Binding DataContext

Menu item icon added programmatically is not displayed

独自空忆成欢 提交于 2019-11-27 09:50:20
I have a display menu item icon issue when trying to add a checked image programmatically: private void ObjectsCanvas_MouseRightButtonDown(object sender, MouseButtonEventArgs e) { ContextMenu cm = new ContextMenu(); MenuItem mDiag = new MenuItem(); mDiag.Icon = new System.Windows.Controls.Image { Source = (new BitmapImage(new Uri("assets/checked-32-context.png", UriKind.Relative))) }; mDiag.Header = Application.Current.Resources["DiagScreenMenuText"].ToString(); cm.Items.Add(mDiag); cm.PlacementTarget = sender as Button; cm.IsOpen = true; } The checked-32-context.png image is used only here,

Android : Get view Reference to a Menu Item

假如想象 提交于 2019-11-27 07:44:58
I plan to use quick actions UI pattern in my application. Android Quick Actions UI Pattern . The quick action window needs a pivot view to stick to. quickAction.show(View pivotView); I intend to use quick action for the menu Item, I can get access to the item that is clicked. But the problem is i need to reference a view from the menu item so that i can pass it to the quick action. How can i get reference to a view in the menuItem that is selected. You can achieve this by providing your menu item with an actionViewClass property in xml and then you will be able to get the pivot view u wanted.

Android adding a submenu to a menuItem, where is addSubMenu()?

左心房为你撑大大i 提交于 2019-11-27 07:12:49
I want to add a submenu inside my OptionsMenu to a menuItem, programatically according to my parameters. I've checked "MenuItem" in android sdk and there is no addSubMenu() method!, although you can find "hasSubMenu()" and "getSubMenu". Was thinking on doing this in onCreateOptionsMenu: public boolean onCreateOptionsMenu(Menu menu) { MenuItem mi = menu.getItem(MYITEMID); // << this is defined in my XML optionsMenu SubMenu subm = mi.addSubMenu(0,1,0,"Map 1"); // no addSubMenu() method!!!??? .... How do I create a submenu inside a menuitem in code? Sometimes Android weirdness is really amazing

Mutually exclusive checkable menu items?

对着背影说爱祢 提交于 2019-11-27 06:48:25
Given the following code: <MenuItem x:Name="MenuItem_Root" Header="Root"> <MenuItem x:Name="MenuItem_Item1" IsCheckable="True" Header="item1" /> <MenuItem x:Name="MenuItem_Item2" IsCheckable="True" Header="item2"/> <MenuItem x:Name="MenuItem_Item3" IsCheckable="True" Header="item3"/> </MenuItem> In XAML, is there a way to create checkable menuitem's that are mutually exclusive? Where is the user checks item2, item's 1 and 3 are automatically unchecked. I can accomplish this in the code behind by monitoring the click events on the menu, determining which item was checked, and unchecking the

Using a DataTemplate for a MenuItem causes extra space on the left side to appear?

不打扰是莪最后的温柔 提交于 2019-11-27 06:36:40
问题 Whenever I attach a DataTemplate to a MenuItem, each generated menu item gets an extra space on the left side. This extra space looks as wide as the space reserved for the check, which I use. Building a menu manually without a DataTemplate doesn't add this extra space. As an extra wrinkle, if I click on this extra space the menu item goes away but no click event is generated. I don't know why it's adding this extra space. Any ideas? my xaml code couldn't be more simpler: Menu with the

Showing Custom Layout on Overflow Drop Down Menu Item? Android

我只是一个虾纸丫 提交于 2019-11-27 05:58:09
问题 I am trying to figure out how to show a custom view for items inside the overflow menu (on right of actionbar) but I can't seem to figure it out. It still shows the title only :S. I want to do something like how twitter has it to show an icon, title, and subtitle in the first item in drop down menu. Can anyone help me out Item in Menu.xml <item android:id="@+id/action_dropdown" android:icon="@drawable/ic_action_overflow" android:actionProviderClass="efwefwef.com.actionbar.ABDropDown" android