Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 825415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:15:05+00:00 2026-05-15T03:15:05+00:00

I have an Adorner in XAML that I’m using for ErrorValidation. Basically I have

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T03:15:06+00:00Added an answer on May 15, 2026 at 3:15 am

    What you’re looking for is called a MultiBinding and is built into WPF (though not in Silverlight.)

    <Grid>
        <Grid.Resources>
            <c:BooleanPairToVisibilityConverter x:Key="booleanPairToVisibility" />
        </Grid.Resources>
        <Grid.Visibility>
            <MultiBinding Converter="{StaticResource booleanPairToVisibility}">
                <Binding ElementName="errorAdorner" Path="AdornedElement.IsFocused" />
                <Binding ElementName="errorAdorner" Path="AdornedElement.IsMouseOver" />
            </MultiBinding>
        </Grid.Visibility>
    </Grid>
    

    Then you need a simple IMultiValueConverter to translate those values into a Visibility:

    public class BooleanPairToVisibilityConverter : IMultiValueConverter {
        public object Convert( object[] values, Type targetType, object parameter, CultureInfo culture )
        {
            if ( 2 != values.Length ) throw new ArgumentException( "values" );
            return ( (bool)values[0] || (bool)values[1] ) ? Visibility.Visible : Visibility.Collapsed;
        }
    
        public object[] ConvertBack( object value, Type[] targetTypes, object parameter, CultureInfo culture )
        { throw new NotSupportedException(); }
    }
    

    Admittedly, this doesn’t solve the second question about how to do this with Triggers. I wouldn’t…

    If you want an animation around a change in the ErrorDetails element’s visibility, set the trigger on the visibility property directly – it should get invoked when the MultiBinding causes the DependencyProperty’s value to change. Also, it might be worth considering Behaviors to accomplish that instead as they’re a little more straightforward for attaching simple animations.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.