本文介绍了XAML中的文本框数据验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我需要在wpf应用程序中处理数据验证,其中必要的验证仅限于xaml文件.
即,
//a.xaml
.....
< window>
< grid>
< textbox height ="33" name ="MyLblelTxt" verticalalignment ="Top">
<标签名称="MyTextBox" Horizo​​nalAlignment =左"> DigitTB</标签</
< Button Horizo​​ntalAlignment ="Top" Name ="Button1"> Button</Button>


......
......
单击按钮时Textbox的一些基本属性,
1.只接受数字
2.应防止/禁止使用空字符
3.值的范围(即文本框应支持0-9999)
3.在文本框中键入非数字键(通过显示Redborder)时突出显示错误.
我需要知道如何仅在XAML中实现相同的目标,

我正在使用WPF VS2008,Windows 7 o/s.
解决上述问题的任何帮助都将是可观的.

问候,
Samanth_90

Hi All,

I need to handle data validation in my wpf application where the necessary validation confines to xaml file.
viz.,
//a.xaml
.....
<window>
<grid>
<textbox height="33" name="MyLblelTxt" verticalalignment="Top">
<Label Name="MyTextBox" HorizonalAlignment="Left">DigitTB</Label>
<Button HorizontalAlignment="Top" Name="Button1">Button</Button>


......
......
Some essential properties of Textbox on click of button,
1.Accept only numerals
2.Empty characters should be prevented/disallowed
3.Range of Values(viz., Text box should support 0-9999)
3.Highlight error on keying non-numerals(by display of Redborder) in the Text box.
I need to know how could one accomplish the same in XAML only,

I am using WPF VS2008, Windows 7 o/s.,
Any help in resolving the above would be appreciable.

With Regards,
Samanth_90

推荐答案


这篇关于XAML中的文本框数据验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 00:55
查看更多