<Button >
<Button.Background>
<LinearGradientBrush>
<GradientStop Color="Blue" Offset="0"></GradientStop>
<GradientStop Color="Black" Offset="0.5"></GradientStop>
<GradientStop Color="Blue" Offset="1"></GradientStop>
</LinearGradientBrush>
</Button.Background>
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Loaded">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard >
<ColorAnimation Storyboard.TargetProperty="Background.GradientStops[1].Color" From="Black" To="White" Duration="0:0:2" AutoReverse="True" RepeatBehavior="Forever">
</ColorAnimation>
</Storyboard>
</BeginStoryboard>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Background.GradientStops[1].Offset"
From="0" To="1" Duration="0:0:2" AutoReverse="True" RepeatBehavior="Forever">
</DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Button.Triggers>
</Button>
效果图变化:
==》