c#
wpf
ui
5 years, 5 months ago
<Window x:Class="Train.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Train"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Rectangle x:Name="redBrush" Width="20" Height="20" Fill="Red" Stroke="Black" RadiusX="2" RadiusY="2">
<Rectangle.Triggers>
<EventTrigger RoutedEvent="Rectangle.MouseDown">
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetName="redBrush"
Storyboard.TargetProperty="(Rectangle.Fill).Color" From="Red" To="Blue" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Rectangle.Triggers>
</Rectangle>
</Window>
0 Comments
Please Login to Comment Here