Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
329
Disabling chart animation
posted
I have an application that has several charts.  Some of my users like the chart animation and other don't, so I need to make it an option.  How can I bind the animation to an application setting?   

<igCA:Series.Animation>

   <igCA:Animation Style="{DynamicResource PieChartAnimationStyle}"></igCA:Animation>

</igCA:Series.Animation>

My animation style is defined in an external xaml file. I tried binding the IsEnabled property of the Animation, but it seems that the IsEnabled property does not have any effect on whether or not the animation runs.

Is there way to turn the animation on and off through binding?

John Myczek

  • 28496
    Verified Answer
    Offline posted

     try using the Duration property instead.  here i define the style as referring to a static resource; you can use whatever logic you need to replace the binding.

        <Window.Resources>
            <sys:Boolean x:Key="MyBool">True</sys:Boolean>
            <Style x:Key="PieChartAnimationStyle" TargetType="{x:Type igCA:Animation}">
                <Style.Triggers>
                   
                    <DataTrigger Binding="{Binding Source={StaticResource MyBool}}" Value="True">
                        <Setter Property="Duration" Value="0:0:0" />       
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Source={StaticResource MyBool}}" Value="False">
                        <Setter Property="Duration" Value="0:0:1" />
                    </DataTrigger>
                </Style.Triggers>   
            </Style>
        </Window.Resources>