将快捷键应用于sliverlight页面 [英] Apply shortcut keys to sliverlight page
问题描述
嗨..
在申请中要求如下.
在Silverlight子页面(用户控件,当您单击菜单项)打开页面时,它需要填充一些数据,然后要保存,我们有保存"按钮,要取消它,有取消"按钮.
在这里我正在寻找要保存的数据,我需要使用ShortCut Keys(Ctrl + S).如果我在KeyDown事件中编写了以下代码,则无法正常运行,因为通常我们在Presssed模式下按``Ctrl''键,然后如果我没有按下"Ctrl"键,那么我们在这里打"S"键,那么它就不起作用了.如果按"Ctrl"键然后释放它,然后按"S"键就可以了..
Hi..
In application requirement is as follows..
In the Silverlight child page(Usercontrol, when you click menu item )open page it requires to fill some data then for saving we have Save button for cancel it we have Cancel button.
Here i am looking for Saving data i need to use ShortCut Keys(Ctrl + S).If i write the following code in KeyDown event it is not Functioning well, because Generally we punch the ''Ctrl'' key in Presssed mode and then we punch the "S" key here if i punch ''Ctrl'' key is not released then it is not working..Otherwise ie. if punch "Ctrl" key then release it then punch "S" it is working fine..
//Code
//int count=0;--Global---
protected override void OnKeyDown(KeyEventArgs e)
{
base.OnKeyDown(e);
if (e.Key == Key.Ctrl)
{
count = 1;
}
string str = e.Key.ToString();
if (count >0 && str == "S")
{
//MessageBox.Show("Saved");
//Saving the data
count = 0;
}
}
我正在寻找它可以在按下模式下使用"Ctrl"键
请调查这个...
谢谢.
I am looking for it works on With "Ctrl" key is in pressed mode
please look into this...
Thanks.
推荐答案
看看此帖子.
这篇关于将快捷键应用于sliverlight页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!