I am trying to paste an image in TextBox on either user presses Ctrl + V shortcut or right-click and select paste option. I tried this method to capture the keyboard key but it only works if I enter V
if(e.Key == Windows.System.VirtualKey.V)
How to capture Ctrl + V both keyboard keys. In my case, this is not working
if (e.Key == Windows.System.VirtualKey.V && e.Key == Windows.System.VirtualKey.Control)
In order to capture the control key, you need to check the HasFlag
property.
var controlDown = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down);
if (controlDown & e.Key == Windows.System.VirtualKey.V)
{
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.