Thursday, October 6, 2016

How to convert a character in to equivalent System.Windows.Input.Key Enum value?

How to convert a character in to equivalent System.Windows.Input.Key Enum value?

            var c = Convert.ToChar(KeyInterop.VirtualKeyFromKey(key));
            Debug.WriteLine("k: " + key);
            Debug.WriteLine("c: " + c);

Reference:

http://stackoverflow.com/questions/289792/int-to-char-in-c-sharp

No comments: