We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Accordion Header Foreground Animation

Thread ID:





125234 Aug 1,2016 10:24 PM UTC Aug 12,2016 01:44 AM UTC WPF 3
Tags: SfAccordion
Harald Betzler
Asked On August 1, 2016 10:24 PM UTC

Hi, I'm very new to syncfusion.

Wpf SfAccordions header item text is animated (changes foreground color from white to grey and vise versa).
Is there a possibility to set the colors (e.g. changes foreground color from green to red)?

I'm able to simple set the foreground color to red, but then I'll have no more animation.

Vijayalakshmi Roopkumar [Syncfusion]
Replied On August 2, 2016 12:40 PM UTC

Hi Harald,

Thank you for contacting Syncfusion Support.

We have prepared a sample that tries to meet your requirement. To change the foreground for the header text on animation, we need to set the trigger to change the foreground when the header item get selected in the HeaderTemplate of SfAccordion. The same as has been depicted as below in the following code snippet as follows: 
 Code snippet: 
<Style TargetType="TextBlock">
<DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSourceMode=FindAncestor, AncestorType={x:Type syncfusion:SfAccordionItem}}}"Value="True">
<Setter Property="Foreground" Value="Red" />
<DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSourceMode=FindAncestor, AncestorType={x:Type syncfusion:SfAccordionItem}}}"Value="False">
<Setter Property="Foreground" Value="Green" />
<TextBlock Text="{Binding}" Margin="10" FontSize="18"/>

Vijayalakshmi V.R. 

Harald Betzler
Replied On August 4, 2016 11:53 AM UTC

Hi Vijayalakshmi,

thank you for the quick response. It works! I'm happy. 

But in your snippet I had to replace "RelativeSourceMode=FindAncestor" with "RelativeSource FindAncestor".

Just one thing:
Now the colors change immediately. There is no more animation, which lets the colors change smoothly in the default configuration.


Vijayalakshmi Roopkumar [Syncfusion]
Replied On August 12, 2016 01:44 AM UTC

Hi Harald,

Thank you for your update.

We have prepared a sample that tries to meet your requirement. In our sample, we have override the AccordionButtonStyle of SfAccordion, by setting the different Duration time and set the desired color using color animation in the Collapsed and Expanded Visual state. And set the AccordionButtonStyle to  achieve the animation for each of desired accordion item. Please find the code snippet for the same below: 

<VisualState x:Name="Collapsed"> 
<DoubleAnimation BeginTime="00:00:00" Duration="00:00:15" Storyboard.TargetName="icon" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" To="0"/> 
<ColorAnimation Storyboard.TargetProperty="Fill.Color" Storyboard.TargetName="arrow" To="{Binding Source={StaticResource CollapsedStroke},Path=Color}"> 
<ColorAnimation Storyboard.TargetProperty="(ContentControl.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="header" To="Green"> 
<VisualState x:Name="Expanded"> 
<DoubleAnimation BeginTime="00:00:00" Duration="00:00:15" Storyboard.TargetName="icon" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" To="90"/> 
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:5" Storyboard.TargetName="ExpandedBackground" Storyboard.TargetProperty="(UIElement.Opacity)"> 
<EasingDoubleKeyFrame KeyTime="00:00:01" Value="0.1"/> 
<EasingDoubleKeyFrame KeyTime="00:00:02" Value="0.4"/> 
<EasingDoubleKeyFrame KeyTime="00:00:03" Value="0.6"/> 
<EasingDoubleKeyFrame KeyTime="00:00:04" Value="0.8"/> 
<EasingDoubleKeyFrame KeyTime="00:00:015" Value="1"/> 
<ColorAnimation Storyboard.TargetProperty="Fill.Color" Storyboard.TargetName="arrow" To="{Binding Source={StaticResource ExpandedStroke},Path=Color}"> 
<ColorAnimation Storyboard.TargetProperty="(ContentControl.Foreground).(SolidColorBrush.Color)" Duration="0:0:1" Storyboard.TargetName="header" To="Red"> 

And we have also replaced the "RelativeSource Mode = FindAncestor" with "RelativeSource = FindAncestor" in this sample. Please download it from the following link:


Vijayalakshmi V.R.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon