Ristogod
Ristogod

Reputation: 1005

WPF set attached event programmatically

How do you do this programmatically in WPF?

<window Validation.Error="ItemError"></Window>

I am trying to set the attached event for Validation.Error through code, but cannot quite figure out how to do it.

Upvotes: 1

Views: 1171

Answers (1)

Reed Copsey
Reed Copsey

Reputation: 564403

You use Validation.AddErrorHandler to do this:

Validation.AddErrorHandler(this, this.ItemError);

Upvotes: 4

Related Questions