<Window x:Class="InkSample.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525">
<Window.Triggers> <EventTrigger RoutedEvent="Window.Loaded"> <EventTrigger.Actions> <BeginStoryboard> <Storyboard RepeatBehavior="Forever" AutoReverse="True"> <ColorAnimation Storyboard.TargetName="Canvas1" Storyboard.TargetProperty = "(Canvas.Background).(RadialGradientBrush.GradientStops)[0].(GradientStop.Color)" From="Red" To="Orange" Duration="0:0:5"/> <ColorAnimation Storyboard.TargetName="Canvas1" Storyboard.TargetProperty = "(Canvas.Background).(RadialGradientBrush.GradientStops)[1].(GradientStop.Color)" From="Orange" To="Green" Duration="0:0:5"/> <ColorAnimation Storyboard.TargetName="Canvas1" Storyboard.TargetProperty = "(Canvas.Background).(RadialGradientBrush.GradientStops)[2].(GradientStop.Color)" From="Green" To="Blue" Duration="0:0:5"/> <ColorAnimation Storyboard.TargetName="Canvas1" Storyboard.TargetProperty = "(Canvas.Background).(RadialGradientBrush.GradientStops)[3].(GradientStop.Color)" From="Blue" To="Black" Duration="0:0:5"/> <ColorAnimation Storyboard.TargetName="Canvas1" Storyboard.TargetProperty = "(Canvas.Background).(RadialGradientBrush.GradientStops)[4].(GradientStop.Color)" From="Black" To="Red" Duration="0:0:5"/> </Storyboard> </BeginStoryboard> </EventTrigger.Actions> </EventTrigger> </Window.Triggers>
<Grid> <Canvas Name="Canvas1" > <Canvas.Background> <RadialGradientBrush GradientOrigin="0.5,0.5" Center="0.5,0.5" RadiusX="0.5" RadiusY="0.5"> <GradientStop Color="Red" Offset="0.0" /> <GradientStop Color="Orange" Offset="0.40" /> <GradientStop Color="Green" Offset="0.60" /> <GradientStop Color="Blue" Offset="0.80" /> <GradientStop Color="Black" Offset="1.00" /> </RadialGradientBrush > </Canvas.Background> </Canvas> </Grid> </Window>
|