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 7670457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:49:37+00:00 2026-05-31T15:49:37+00:00

I was making animation for all my TreeView….. Having a app.xaml with: <Style TargetType={x:Type

  • 0

I was making animation for all my TreeView…..

Having a app.xaml with:

<Style TargetType="{x:Type TreeView}">
    <Style.Resources>
        <Style TargetType="{x:Type TreeViewItem}">
            <Style.Triggers>
                <EventTrigger RoutedEvent="TreeViewItem.Loaded">
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetProperty="Opacity"
                                             From="0" To="1" BeginTime="00:00:00" Duration="00:00:01" FillBehavior="Stop"/>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Style.Triggers>
        </Style>
      </Style.Resources>
</Style>

It works for for every TreeView, I can see the TreeViewItem fading in.

But then if the TreeView is defined as below with Triggers in the style:

   <TreeView>
        <TreeView.Resources>
            <Style TargetType="{x:Type TreeViewItem}">
                <Style.Triggers>
                    <Trigger Property="IsEnabled" Value="True">
                          //Do some work
                    </Trigger>
                </Style.Triggers>
            </Style>
        </TreeView.Resources>
        <TreeViewItem Header="Item1">
            <TreeViewItem Header="Item2">
                <TreeViewItem Header="Item3"/>
                <TreeViewItem Header="Item4"/>
            </TreeViewItem>
            <TreeViewItem Header="Item5"/>
        </TreeViewItem>            
        <TreeViewItem Header="Item6"/>
    </TreeView>

The animation will not be working anymore.
Is there any solution or workaround for this? I don’t really want to put the whole animation code inside the TreeView…

  • 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-31T15:49:39+00:00Added an answer on May 31, 2026 at 3:49 pm

    1) create a base named style, with your existing style

    <Style x:Key="baseTreeViewStyle" 
           TargetType="{x:Type TreeViewItem}"> existing style here </Style>
    

    2) create a style without a name based on your base style – this will be your implicit global style

    <Style TargetType="{x:Type TreeViewItem}" 
           BasedOn={StaticResource baseTreeViewStyle} />
    

    3) extend the base style in your tree view

    <Style TargetType="{x:Type TreeViewItem}" 
           BasedOn="{StaticResource baseTreeViewStyle}">
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="True">
                  //Do some work
            </Trigger>
        </Style.Triggers>
    </Style>
    

    Now you get an implicit global style, but if you need specific additional behaviour you override the base style.

    To be even more thorough your base style should be based on the default TreeViewItem style

    <Style x:Key="baseTreeViewStyle" 
           TargetType="{x:Type TreeViewItem}" 
           BasedOn="{StaticResource {x:Type TreeViewItem}}"> 
               existing style here 
    </Style>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How would i go about making an animation of a rocket move to another
Actually I am Making an Alarm app. In that When i set the Time
In it's simplest explanation, I'm making a really small interactive movie app on Android.
There is that app called turkey blast: reloaded (link below). The graphics and animation
I am currently making an app that will have multiple timers, which are basically
i am making an animation in opegle with pngs and considering to use the
I am making an app that scrolls information on the desktop. The window is
I have a weird issue whereby I'm programming a carousel-type animation in jQuery. I
I'm making an app that uses the full screen to display an image like
i am making a photography iphone app and am after, upon the app being

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.