WPF 编辑蒙版 [英] WPF Edit Mask

查看:51
本文介绍了WPF 编辑蒙版的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 WPF 中为简单文本框指定编辑掩码的最简单方法是什么?

What is the easiest way to specify an edit mask in WPF for a simple Text Box?

例如一种可在您键入时将 10000 转换为 10,000.

e.g. one that transforms 10000 to 10,000 as you type.

推荐答案

简而言之,没有简单的方法.如果您经常使用遮罩,我建议您使用遮罩功能创建自己的控件.使用 MaskedTextProvider 类应该相当简单.

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.

有关具有屏蔽功能的自定义 TextBox 的示例,请参阅以下内容:

See the following for an example of a custom TextBox with masking capabilities:

屏蔽文本框示例...

这篇关于WPF 编辑蒙版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆