[VC++ & XAML] Keydown event bug when get a touch keyboard input on Metro app
-
Hi, I am a beginner for Metro app development and trying to use the keydown event but not the keyup event with a text box element on the XAML. I have created two key event functions (up and down) from the text box, which are the below. The problem is the keydown function works only when the key is up but not down. If I hold the key press down, the event does not come out until the key up, which is the same as the keyup function. I am working to get keyboard input from the touch softkeyboard. For example, after invoking the touch keyboard with the text box element, I like to play a unique sound only when a key (e.g., 'Q' or 'K') is pressed. Anyone knows how to fix this problem? I also appreciate that you can help me know the alternative way with an example source code. Thank you a lot in advance. MainPage::OnKeyUp(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e) { if((int)e->Key == 112) // F1 key { errorText->Text = "F1 Key up"; } } MainPage::OnKeyDown(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e) { if((int)e->Key == 112) // F1 key { errorText->Text = "F1 Key down"; } }