为什么不设置MenuItem.InputGestureText造成菜单项时,我进行输入的手势来激活? [英] Why doesn't setting MenuItem.InputGestureText cause the MenuItem to activate when I perform the input gesture?

查看:904
本文介绍了为什么不设置MenuItem.InputGestureText造成菜单项时,我进行输入的手势来激活?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望实现键盘快捷键为菜单项。我已经使用了code如下:

I want to implement Keyboard shortcuts for a MenuItem. I have used the code below:

<MenuItem Header="_New" InputGestureText="CTRL+N" Click="NewMenu_Click">
    <MenuItem.Icon>
        <Image Source= "Images\NEW.PNG" Width="25" Height="28" />
    </MenuItem.Icon>
</MenuItem>`

InputGestureText 属性没有响应,当我pressed的 CTRL + N 。我使用Visual Studio的前preSS版2010年我在这里缺少什么?

But the InputGestureText property is not responding when I pressed the CTRL+N. I am using Visual Studio Express Edition 2010. Am I missing anything here?

推荐答案

这是属性的文件中非常明确:

It is quite explicit in the documentation for the property:

这个属性不相关联的   输入手势与菜单项;它   只是添加文本菜单项。该   应用程序必须处理用户的   输入来进行操作。对于   如何关联一个信息   命令菜单项,见   <一href="http://msdn.microsoft.com/en-us/library/system.windows.controls.menuitem.command.aspx">Command.

This property does not associate the input gesture with the menu item; it simply adds text to the menu item. The application must handle the user's input to carry out the action. For information on how to associate a command with a menu item, see Command.

这篇关于为什么不设置MenuItem.InputGestureText造成菜单项时,我进行输入的手势来激活?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆