很抱歉,如果这是一个愚蠢的问题,但我在我的viewmodel类上实现验证时遇到了麻烦。我的代码如下所示:
class modClienteViewModel : Screen, IHandle<vw_ClientesFull>, IDataErrorInfo
{
public Clientes Cliente { get; set; }
public modClienteViewModel(int IDCliente)
{
Cliente = serviceClient.Cliente_GetById(IDCliente);
}
public string Error
{
get { throw new System.NotImplementedException(); }
}
public string this[string columnName]
{
get {
string sError = "";
if (columnName == "Cliente")
sError = "Validation of Client";
return sError;
}
}
}
对象&#34; Cliente&#34;是从WCF服务加载。所以在我的构造函数中,我加载了客户端INFO,并使用绑定到Cliente对象的属性来显示WPF控件。 我面临的问题是验证方法永远不会从对象Cliente中解雇,因此我无法分析其属性以进行验证。我不知道我是否足够清楚,但这一行:
sError = "Validation of Client";
永远不会被执行,因为专栏永远不会得到价值&#34; Cliente&#34;。我确定我在这里做错了,请帮助!谢谢! sError =&#34;验证客户&#34;;