AdornedElement Properties in a Trigger
- by Chris Nicol
I have an Adorner in XAML that I'm using for ErrorValidation.  Basically I have a grid that I want to display on two conditions (if the "AdornedElement" IsFocused or IsMouseOver).
Below is a code snippet where I'm binding - successfully - to the IsFocused of the AdornedElement, but as you can tell that only solves 1/2 the conditions.  Now I can't pass another binding into the converter, nor can I create a property that handles both (needs to be XAML only solution).
 <AdornedElementPlaceholder
                            x:Name="errorAdorner" />
                    ...
  <Grid
     x:Name="ErrorDetails"
     Visibility="{Binding ElementName=errorAdorner, Path=AdornedElement.IsFocused, Converter={StaticResource BooleanToVisibilityConverter}}" />
                   ...
What I want to do is use triggers to handle this, the only problem is I can't access the AdornedElement's properties on a trigger.
Something like this ...
        <Trigger
            SourceName="errorAdorner"
            Property="AdornedElement.IsFocused"
            Value="True">
            <Setter
                TargetName="ErrorDetails"
                Property="Visibility"
                Value="Visible" />
        </Trigger>
This would also help as part of what I want to do is trigger animations, rather than just setting the visibility.
Any help would be great.