WPF: How to programmatically utilize the ErrorTemplate of an Control?
Posted
by geeraija
on Stack Overflow
See other posts from Stack Overflow
or by geeraija
Published on 2010-06-11T08:21:25Z
Indexed on
2010/06/11
8:22 UTC
Read the original article
Hit count: 268
Hi,
is there a way to programmatically set and remove the ErrorTemplate of an Control without the whole Validation mechanism? Basically, what I'd like to do, is to retrieve the ErrorTemplate of an Control at some point like this:
ControlTemplate errTemplate = Validation.GetErrorTemplate(myTxtBx);
and temporarily use it as it's ControlTemplate like this:
myTxtBx.Template = errTemplate;
Can you somehow do this?
© Stack Overflow or respective owner