Rick Kierner
Rick Kierner

Reputation: 714

WPF Masked Textbox with a value that does not contain mask

I need a WPF Textbox that displays a phone number as "(555) 555-5555" but has a value of "5555555555".

All of the examples I'm seeing have the ability to mask the control on the UI but that affects the bound property of my view model so that the property value has the extraneous ()- characters.

Upvotes: 1

Views: 1697

Answers (2)

Peter
Peter

Reputation: 48998

How about an IValueConverter?

Upvotes: 3

Muad'Dib
Muad'Dib

Reputation: 29286

I am thinking that you will probably have to roll-your-own. It shouldn't be too difficult, subclass and override to obtain the results you are looking for.

Upvotes: -1

Related Questions