Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to control the visibility of AdornedElementPlaceholder

$
0
0

Hi have a ControlTemplate that use as an ErrorTemplate. I want to set the Visibility of Image in AdornedElementPlaceholder to collapsed as soon as the property IsEnabled of validating control set to False.

I try to use Trigger to do this, but I cannot get the Value of the property from current validating control. (Textbox)

Could someone help me please.

<TextBox Validation.ErrorTemplate="ErrorTemplate" ..../>

<ControlTemplate x:Key="ErrorTemplate"><Grid><AdornedElementPlaceholder x:Name="ErrorImage"><Image Source="/ABCComponent;Component/EmbeddedResource/Images/Exclamation_Red.png" ToolTip="{Binding Path=(Validation.Errors)[0].ErrorContent}" HorizontalAlignment="Right" Margin="0,0,10,0" Width="16" Height="16" /></AdornedElementPlaceholder></Grid><ControlTemplate.Triggers><Trigger Property="IsEnabled" Value="True"><Setter TargetName="ErrorImage" Property="Visibility" Value="Visible" /></Trigger><Trigger Property="IsEnabled" Value="False"><Setter TargetName="ErrorImage" Property="Visibility" Value="Collapsed" /></Trigger></ControlTemplate.Triggers></ControlTemplate>


 

Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>