Click here to Skip to main content
16,016,623 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
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..
C#
//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.
Posted
Updated 14-May-10 0:34am
v2

1 solution

Have a look at this post.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900