How to restrict special symbols like % in textbox in wpf?

Posted by Vamsy on Stack Overflow See other posts from Stack Overflow or by Vamsy
Published on 2011-02-01T11:45:27Z Indexed on 2011/02/01 15:26 UTC
Read the original article Hit count: 210

Filed under:
|
|

I would like to develop a textbox which restricts special symbols like %. I used textbox's keydown event to restrict '%' . I already used the code as

if(Keyboard.Modifiers == ModifierKeys.Shift && e.key == key.D5)    
{    
    e.handle=true;    
    return;    
}

when i implement this in mvvm architecture, I got problem with the dependency property that recognizes only shift as one key and D5 as another when I converted systemkey into string format.

How can I recognize % symbol?

© Stack Overflow or respective owner

Related posts about wpf

Related posts about textbox