Apply shortcut keys to sliverlight page
Posted
by sankar
on Stack Overflow
See other posts from Stack Overflow
or by sankar
Published on 2010-05-14T10:32:36Z
Indexed on
2010/05/14
10:34 UTC
Read the original article
Hit count: 324
Silverlight
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;
}
}
I am looking for it works on
With "Ctrl" key is in pressed mode
please look into this...
Thanks
© Stack Overflow or respective owner