<Window x:Class="Workspace.DockExample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Workspace" Width="640" Height="480">
<StackPanel>
<Rectangle
Width="100" Height="50" Stroke="Black" StrokeThickness="1"
Grid.Column="2" Grid.Row="1"
HorizontalAlignment="Center" Margin="10">
<Rectangle.Fill>
<SolidColorBrush x:Name="solidColorBrush2" Color="Blue" />
</Rectangle.Fill>
</Rectangle>
<Button Grid.Column="2" Grid.Row="2"
HorizontalAlignment="Center">
Start Animation
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard>
<!-- Animates the opacity of a SolidColorBrush from 1 to 0 over 10 seconds. -->
<DoubleAnimation Storyboard.TargetName="solidColorBrush2"
Storyboard.TargetProperty="Opacity"
From="1.0" To="0.0" Duration="0:0:10" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
</StackPanel>
</Window>
|