WPF:我如何prevent用户在绑定到一个数值属性数据的文本框输入文字? [英] WPF: How do I prevent users from entering text in a Textbox data bound to a numeric property?

查看:71
本文介绍了WPF:我如何prevent用户在绑定到一个数值属性数据的文本框输入文字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WPF:我如何进入绑定到一个数值属性文本框数据文本prevent用户

WPF: How do I prevent users from entering text in a Textbox data bound to a numeric property?

推荐答案

该标准审定会处理这...

The standard validation will handle this...

您还可以使用行为或附加属性,从被输入文本框覆盖的输入至prevent非数字号码。下面是这是否一个样的行为。

You can also use a Behavior or attached property to override TextBox's input to prevent non-numeric numbers from being entered. Here is a sample behavior that does this.

这篇关于WPF:我如何prevent用户在绑定到一个数值属性数据的文本框输入文字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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