WPF Masked Textbox with a value that does not contain mask

倾然丶 夕夏残阳落幕 提交于 2020-01-24 20:20:16

问题


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.


回答1:


How about an IValueConverter?




回答2:


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.



来源:https://stackoverflow.com/questions/1729851/wpf-masked-textbox-with-a-value-that-does-not-contain-mask

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!