Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>(I am using the AdornerDecorator as I had experienced in a previous program the error style not being re-rendered when swapping tab pages. I can't remember where I saw this but it did help me out)</p> </blockquote> <p>Presumably this indeed important tip originates from <a href="http://karlshifflett.wordpress.com/" rel="nofollow noreferrer">Karl Shifflets blog</a>, at least he's addressing the same topic: <a href="http://karlshifflett.wordpress.com/2008/02/19/wpf-validation-errors-disappear-inside-tabcontrol-when-switching-tabitems/" rel="nofollow noreferrer">WPF Validation Errors Disappear Inside TabControl When Switching TabItems</a>.</p> <p>Given this your issue might just be related, i.e. the tip/code above ensures there is a dedicated <a href="http://msdn.microsoft.com/en-us/library/system.windows.documents.adornerlayer.aspx" rel="nofollow noreferrer"><code>AdornerLayer</code></a> for every tab item now, as the adorner layer of the parent element is discarded when you switch tabs. This dedicated adorner layer appears to still require some special treatment though, see for example question <a href="https://stackoverflow.com/questions/1194181/wpf-errortemplate-visible-when-not-focused">WPF ErrorTemplate visible when not focused?</a> which is basically dealing with your issue upside down. Consequently I'd suggest you combine and expand the outlined solution for the latter with your style and try the following (untested code as of now though):</p> <pre><code>&lt;Style x:Key="ErrorTemplate" TargetType="{x:Type TextBox}"&gt; &lt;Style.Triggers&gt; &lt;Trigger Property="Validation.HasError" Value="True"&gt;...&lt;/Trigger&gt; &lt;Trigger Property="IsVisible" Value="false"&gt; &lt;Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/&gt; &lt;/Trigger&gt; &lt;Trigger Property="IsVisible" Value="true"&gt; &lt;Setter Property="Validation.ErrorTemplate"&gt; &lt;Setter.Value&gt;...&lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Trigger&gt; &lt;/Style.Triggers&gt; &lt;/Style&gt; </code></pre> <p>See my comment regarding your update of <a href="https://stackoverflow.com/questions/1284549/radio-button-error-style">Radio Button Error Style</a> too, which tries to similarly address your likely related question; have you actually tried my suggestion there?</p> <p>See <a href="http://msdn.microsoft.com/en-us/library/ms743737.aspx" rel="nofollow noreferrer">Adorners Overview</a> for more details on the adorner architecture. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload