Novice
Novice

Reputation: 2487

Validation Error in Wpf

How to check whether the text box has validation errrors in .cs file. I have attached validation rule 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>)

Upvotes: 0

Views: 935

Answers (1)

Muhammad Hasan Khan
Muhammad Hasan Khan

Reputation: 35126

Validation.HasError attached property is there

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

bool hasError = Validation.GetHasError(txtAttributeName)

Upvotes: 1

Related Questions