maxim bazhanov
maxim bazhanov

Reputation: 39

Key char on Windows Phone

I want to determine the symbol that user entered by keypad. For example in Windows Forms KeyPressEventArgs has KeyChar property, but there is no this property for KeyEventArgs in Windows Phone.

It's needed to handle this event, because i want to handle some cyrillic symbols.

Upvotes: 1

Views: 352

Answers (2)

Romasz
Romasz

Reputation: 29792

As you have said e.Key and e.PlatformKeyCode don't grant success - e.Key = Key.Unknown.
But I think you can try to do like this:

private void myTextbox_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
{
   char added = myTextbox.Text.ElementAt(myTextbox.Text.Length - 1);
}

When the users enters symbol - check the last added to text, as I've checked it works with cyrillic. Then in the same event you can do what you want with this text or symbol.
I've checked this on TextBox thought I don't know if your problem is concerned with it.

Upvotes: 1

Cosmin Vană
Cosmin Vană

Reputation: 1582

You can use the Key property from the event args:

if(e.Key == Key.Enter) { }

Upvotes: 0

Related Questions