■ DoubleAnimation 엘리먼트의 FillBehavior 속성 값을 비교해서 동작 방법을 보여준다.
▶ MainWindow.xaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
<Window x:Class="TestProject.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="800" Height="600" Title="TestProject" FontFamily="나눔고딕코딩" FontSize="16"> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> <Rectangle Name="rectangle1" Width="100" Height="100" Opacity="1" Fill="Red" /> <Rectangle Name="rectangle2" Margin="0 10 0 0" Width="100" Height="100" Opacity="1" Fill="Orange" /> <Button Margin="0 10 0 0" Width="250" Height="30" Content="FillBehavior 속성 테스트 시작"> <Button.Triggers> <EventTrigger RoutedEvent="Button.Click"> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetName="rectangle1" Storyboard.TargetProperty="Width" Duration="00:00:05" FillBehavior="HoldEnd" From="0" To="300" /> <DoubleAnimation Storyboard.TargetName="rectangle2" Storyboard.TargetProperty="Width" Duration="00:00:05" FillBehavior="Stop" From="0" To="300" /> </Storyboard> </BeginStoryboard> </EventTrigger> </Button.Triggers> </Button> </StackPanel> </Window> |