开发者

Validation Error in Wpf

开发者 https://www.devze.com 2023-02-02 02:05 出处:网络
How to check whether the text box has validation errrors in .cs file. I have attached validation rule开发者_StackOverflow社区 for the textbox and i display the error message in the UI. Would i be able

How to check whether the text box has validation errrors in .cs file. I have attached validation rule开发者_StackOverflow社区 for the textbox and i display the error message in the UI. Would i be able to check whether a textBox has validation error.

Edited :

I found the answer :

Validation.GetHasError(<textbox instance>)


Validation.HasError attached property is there

http://msdn.microsoft.com/en-us/library/system.windows.controls.validation.haserror.aspx

bool hasError = Validation.GetHasError(txtAttributeName)
0

精彩评论

暂无评论...
验证码 换一张
取 消