menuitem

Dealing with WPF Menu HeaderStringFormat and Access Keys among other things

为君一笑 提交于 2019-12-23 11:57:20
问题 Okay. So I want my application to display in its main menu the "Save" and "Save As..." items just like Visual Studio does; i.e. "Save {current file}" and "Save {current file} As..." I would also like to have the normal access keys ("S" and "A", respectively). I've come up with two solutions, but neither is very desirable. Instead of creating the main menu exclusively in xaml, I could create it all in the MainWindowViewModel so I'd have full control over what goes into the generated MenuItems.

Unable to set System.Windows.Controls.MenuItem.Icon thru a setter

南楼画角 提交于 2019-12-23 09:31:09
问题 Hi I am trying to have a MenuItem.Icon set thru a style setter: <Style x:Key="MenuItem_Delete" TargetType="MenuItem" BasedOn="{StaticResource {x:Type MenuItem}}"> <Setter Property="Header" Value="_Delete"/> <Setter Property="MenuItem.Icon"> <Setter.Value> <Image Source="Resources/Delete.png"/> </Setter.Value> </Setter> </Style> I get the following exception at runtime: Cannot add content of type 'System.Windows.Controls.Image' to an object of type 'System.Object'. Error at object 'System

WPF Menuitem Border

江枫思渺然 提交于 2019-12-23 09:27:31
问题 I've run into a problem trying to implement a Menu and can't figure out what is going on. I'm trying to make a single-layer menu using the Menu control. Here is my menu code: <Menu DockPanel.Dock="Top" Height="22" Name="menu1" VerticalAlignment="Top" Background="#FF325170"> <MenuItem Header="Featured" Style="{StaticResource menuItemStyle}" /> <MenuItem Header="Search" Style="{StaticResource menuItemStyle}" /> </Menu> And my style for my MenuItem s is as follows: <Style x:Key="menuItemStyle"

WPF XAML defined MenuItem reuse starts working, then disappears

删除回忆录丶 提交于 2019-12-23 08:39:11
问题 The following simple code attempts to reuse a MenuItem defined in the Window.Resources on two separate Menus. <Window x:Class="WpfApplication.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:collections="clr-namespace:System.Collections;assembly=mscorlib" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <collections:ArrayList x:Key="menuItemValues"> <MenuItem Header="First"/> <MenuItem

Change positions of menu items and hamburger button for a right-side drawer

馋奶兔 提交于 2019-12-23 05:39:09
问题 In my Toolbar , I have a menu with one item "settings", and a DrawerLayout with a hamburger icon aligned to the right. Now it looks like this: I want the hamburger to be on the right, like this: menu.xml : <menu xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/settings" android:icon="@drawable/ic_settings_black_48dp" app:showAsAction="always" /> </menu> MainActivity : public class MainActivity extends

GTK+ MenuItem Size Small

主宰稳场 提交于 2019-12-23 05:32:38
问题 On a machine running Windows, the MenuItems are too small for my use case. Therefore, my question is, " how I may increase the font size of the text "Save", "Load" and "Exit?" " If not, then how can I increase the padding between the MenuItems? (without adding more of those line separators as seen between "Load" and "Exit") Additionally, how may I remove the intermediate variable SubMenu1 , if possible? Cropped Screenshot Below is a complete source to reproduce: #include <gtk/gtk.h> int main

WPF: MenuItem icon in the wrong place when using data template

放肆的年华 提交于 2019-12-23 05:14:28
问题 I have the following code: <Menu> <MenuItem ItemsSource="{Binding SomethingMenuItems}" Header="Something"/> </Menu> Where MenuItems is a collection of objects of type SomethingMenuItem. I also have: <DataTemplate DataType="{x:Type SomethingMenuItem}"> <MenuItem Header="{Binding OrderTypeName}"> <MenuItem.Icon> <Image Source="{Binding IconName}"/> </MenuItem.Icon> </MenuItem> </DataTemplate> I'd expect to get (I get something like this when I hardcode the menu items): What I get instead is:

How I could cancel opening the system menu of an application?

痞子三分冷 提交于 2019-12-23 02:52:18
问题 I need a way to hide or cancel opening the system menu when the user makes click on it (completely disable the menu is my last resort, I preffer to hide it) Searching info about this in MSDN I've seen the DestroyMenu API function: http://msdn.microsoft.com/en-us/library/windows/desktop/ms647631%28v=vs.85%29.aspx <DllImport("user32.dll")> Private Shared Function DestroyMenu( ByVal hMenu As IntPtr) End Function But when I try it the system menu of the application loose the "Style" and is not

Add items to menu group programatically in navigation view

折月煮酒 提交于 2019-12-22 10:54:40
问题 I am trying to add menu items to menu group pragmatically but I found no way to do that. I am using Navigation View and added below mentioned menu: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/nav_lang_currency" android:title="" /> <item android:id="@+id/nav_home" android:title="" /> <group android:id="@+id/nav_refer" /> <item android:id="@+id/nav_setting" android:title="" /> <item android:id="@+id/nav_about_us

Sliding menu gesture overwrites the scrollable gesture of a graph gesture-android

若如初见. 提交于 2019-12-22 10:27:49
问题 I am using a sliding menu from here in my application. My app also has a GraphView in which I set some data in real time. The graph is a linear graph which is scrollable, to the left and to the right. But, having the sliding menu by a left to right gesture, the user cannot scroll in the graph because the menu keeps popping out. Is there any way I can overwrite the menu functionality when a certain item is pressed? The graph item is just a LinearLayout. I am also using fragments, so each menu