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

  • Home
  • SEARCH
  • 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 4341212
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:27:15+00:00 2026-05-21T11:27:15+00:00

I have a WPF page. Page has some content, but the last child component

  • 0

I have a WPF page. Page has some content, but the last child component of page’s root layout is a user control that I have created. It looks like this:

<UserControl DataContext=UserControlViewModel>
  <UserControl.Resources>
    <BooleanToVisibilityConverter x:Key="visibilityConverter" />
  </UserControl.Resources>
  <Grid 
      Name="grid" 
      Visibility="{Binding IsOn, Converter={StaticResource visibilityConverter}}">
    <!-- Border to dim everything behind my user control -->
    <Border Background="#000000" Opacity="0.4" />
    <!-- The following border is red and holds the content -->
    <Border 
        Width="{Binding ElementName=txt, Path=ActualWidth}" 
        Height="{Binding ElementName=txt, Path=ActualHeight}" 
        Margin="{Binding ElementName=txt, Path=Margin}" 
        HorizontalAlignment="{Binding ElementName=txt, Path=HorizontalAlignment}" 
        VerticalAlignment="{Binding ElementName=txt, Path=VerticalAlignment}" 
        Background="Red">
      <TextBlock 
          Name="txt"
          Width="200" 
          Height="100" 
          Margin="20" 
          HorizontalAlignment="Center" 
          VerticalAlignment="Center" 
          Text="This is my super awesome message!" />
    </Border>
  </Grid>
</UserControl>

By default, the IsOn property of the UserControlViewModel object is set to false, i.e. the user control is not visible. I have implemented some logic that changes this property to true and then the user control is displayed in front of all other components which are dimmed. This works well.

Now, I want to create a fade effect animation which would dim the components that are behind the user control once it becomes visible. Next, I want to make my red border that holds the content to fade in from the left hand side, so moving + fade.

Let’s start with the fade effect first. I wrote this style to the Border that is supposed to do the dimming of background components:

<UserControl DataContext=UserControlViewModel>
  <UserControl.Resources>
    <BooleanToVisibilityConverter x:Key="visibilityConverter" />
  </UserControl.Resources>
  <Grid 
      Name="grid"
      Visibility="{Binding IsOn, Converter={StaticResource visibilityConverter}}">
    <!-- Border to dim everything behind my user control -->
    <Border Background="#000000" Opacity="0.4">
      <!-- The following style is new code -->
      <Border.Style>
        <Style TargetType="Border">
          <Style.Triggers>
            <Trigger Property="{Binding ElementName=grid, Visibility}" Value="Visible">
              <Trigger.EnterActions>
                <BeginStoryboard>
                  <Storyboard>
                    <DoubleAnimation 
                        Storyboard.TargetProperty="Opacity" 
                        From="0.0" 
                        To="0.4" 
                        Duration="0:0:1" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.EnterActions>
            </Trigger>
          </Style.Triggers>
        </Style>
      </Border.Style>
    </Border>
    ...

But there’s the problem: I cannot set the binding on the trigger Property, because it is not a dependency property. I need a way to tell my trigger to fire once the grid has got the Visibility property set to Visible. Please help and thank you!

Second problem is, I don’t know how to do the moving of the red border, so I need help around some scale transformations as well, I guess… Thanks once again!

  • 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-21T11:27:16+00:00Added an answer on May 21, 2026 at 11:27 am

    try replacing the following line:

    Original:

    <Trigger Property="{Binding ElementName=grid, Visibility}" Value="Visible">
    

    Replacement:

    <DataTrigger Binding={Binding Visibility, ElementName=grid} Value="Visibile">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF page that has 2 ContentControls on it. Both of the
I have a user control...and the base page(s) which uses this user control has
I have a frame control in a WPF app which has an HTML page
i have found that WebBrowser control (both Winforms and WPF) has certain javascript constructs
In WPF I have one window opening a second window that allows some data
I have a WPF page with validation rules. This page has 2 grids -
I have a WPF page that contains a Listbox and a frame. The frame
In a WPF page that I'm designing for my church, I have two ListBox
In my project I have a DLL for some WPF/XAML controls that need to
I have WPF Span that is used as a source to a TextBlock. I

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.