What is the easiest way to specify an edit mask in WPF for a simple Text Box?
e.g. one that transforms 10000 to 10,000 as you type.
What is the easiest way to specify an edit mask in WPF for a simple Text Box?
e.g. one that transforms 10000 to 10,000 as you type.
Short answer, there is no easy way. If you use masks quite often, I would recommend creating your own control with masking functionality. Using the MaskedTextProvider class should be fairly straightforward.
See the following for an example of a custom TextBox with masking capabilities:
Masked TextBox example...
Easiest and most straightforward way is probably just to grab the TextChanged event and do whatever processing you need.
ex... http://karlhulme.wordpress.com/2007/02/15/masking-input-to-a-wpf-textbox/
Have you looked at the Xceed DataGrid Express for WPF. It is free and provides a masked text box control that will very simply do what you want.
The xceed Datagrid Express edition for WPF is no longer available.