I have a problem when using ColorAnimationUsingKeyFrames. Briefly:
In Colors.xaml:
<Color x:Key="Color_Main">#ff0000</Color>
<SolidColorBrush x:Key="Brush_Main" Color="{DynamicResource Color_Main}" />
In styles.xaml:
<VisualState x:Name="State_Highlighted">
<Storyboard>
<ColorAnimationUsingKeyFrames Storyboard.TargetName="TextTitle" Storyboard.TargetProperty="Foreground.Color">
<EasingColorKeyFrame KeyTime="0" Value="{StaticResource Color_White}" />
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
I have multiple buttons that use the Brush_Main
brush and the same animation.
I was using:
<SolidColorBrush x:Key="Brush_Main" Color="{StaticResouce Color_Main}" />
instead of:
<SolidColorBrush x:Key="Brush_Main" Color="{DynamicResource Color_Main}" />
and everything was working fine, but I had to switch to DynamicResource
as I'm editing the color from code behind at some point.
My problem is, now, whenever I hover over any button of my buttons, all the buttons will do the animation.
Is there any workaround to solve this? I've been looking through the internet for days.
Thanks in advance.