C# 更多验证条件

C# 更多验证条件,c#,wpf,C#,Wpf,我有3个文本框,当它不满足特定条件时,我尝试添加验证提示。条件如下: Disable submit button and show hints until textbox1 <= textbox2 and textbox3 >= 15% of textbox2 我想补充一下 [CustomCondition(ErrorMessage = "textbox must have at least three characters")] (like line 5 of the code)

我有3个文本框,当它不满足特定条件时,我尝试添加验证提示。条件如下:

Disable submit button and show hints until textbox1 <= textbox2 and textbox3 >= 15% of textbox2
我想补充一下

[CustomCondition(ErrorMessage = "textbox must have at least three characters")] (like line 5 of the code)

我只是不知道我该怎么做。我知道如何禁用按钮,直到条件确定,但我也尝试在文本框上给出验证提示。

数据注释不是执行这种同时涉及多个属性的验证的方法


您应该做的是实现.NET Framework 4.5中引入的
INotifyDataErrorInfo
接口。有关如何实现它的更多信息和示例,请参阅。

数据注释不是执行此类验证的方法。您应该做的是实现
INotifyDataErrorInfo
接口:
[CustomCondition(ErrorMessage = "textbox must have at least three characters")] (like line 5 of the code)