










使用此功能时,主要分为两步:
1、在数据校验字段中,添加用于界面显示的标识:
[Display(Name="登录名称", Description="输入登录名称")]
[Required(ErrorMessage="请输入登录名称")]
public string loginName{}
如果未添加此标识,显示时:loginName 为必需字段
2、设置显示的方式:
<TextBox Height="23" Name="textBox1" Text="{Binding pcode, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}" Grid.Row="1" Grid.Column="1" />
<dataInput:DescriptionViewer Name="dvLoginName" Grid.Row="1" Grid.Column="2" Target="{Binding ElementName=user}" PropertyPath="pcode" />
//显示出错汇总
<dataInput:ValidationSummary Grid.Row="5" Grid.Column="1"/>
显示结果:
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。