Answer the question
In order to leave comments, you need to log in
How in EventTrigger, in animation, set the color from the application settings?
I created my own button in style. All colors are stored in the application settings (and the user can change them, which is why they are stored in the settings). The base color of the button is set like this (the code is simplified):
<Style TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Rectangle x:Name="RectangleBackground"
Fill="{Binding ColorButtonBackground,
Source={x:Static res:Settings.Default}}"/>
<ControlTemplate.Triggers>
...
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<EventTrigger RoutedEvent="MouseEnter">
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetName="RectangleBackground"
Storyboard.TargetProperty="(RectangleBackground.Background).(SolidColorBrush.Color)"
To="{Binding ColorButtonBackgroundHighlighted,
Source={x:Static res:Settings.Default}}"/><!--Error-->
</Storyboard>
</BeginStoryboard>
</EventTrigger>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question