Reputation: 1546
I have a button in a stack panel
<StackPanel>
<Button x:Name="CreateBtn" Content="Create" Style="{StaticResource PopUpButton}" Width="120" HorizontalAlignment="Right" Margin="0 60 30 0" Command="{Binding SaveCardTypeCommand}" />
</StackPanel>
that's use a style in a file
<Style x:Key="PopUpButton" TargetType="Button">
<Setter Property="Foreground" Value="#1172b7"/>
<Setter Property="BorderBrush" Value="#1172b7"/>
<Setter Property="BorderThickness" Value="3"/>
</Style>
I need to change color to red of the content and the borderbrush when the button is disabled
How can I do this?
Best regards
Upvotes: 0
Views: 2733
Reputation: 4885
Using expression blend edit the default template of the button and customize the visual states. You can define animations to every visual state.
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="Border">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<SolidColorBrush Color="Red"/>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<SolidColorBrush Color="Red"/>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
Upvotes: 1