728x90
728x170
▶ MainWindow.xaml
<Window x:Class="TestProject.MainWindow"
Name="window"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="800"
Height="600"
Title="ColorAnimation 엘리먼트 사용하기"
FontFamily="나눔고딕코딩"
FontSize="16">
<Window.Resources>
<Style TargetType="{x:Type RadioButton}">
<Setter Property="Margin" Value="10" />
</Style>
</Window.Resources>
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}">
<RadioButton Content="Red">
<RadioButton.Triggers>
<EventTrigger RoutedEvent="RadioButton.Checked">
<BeginStoryboard>
<Storyboard>
<ColorAnimation
Storyboard.TargetName="window"
Storyboard.TargetProperty="Background.Color"
Duration="0:0:1"
To="Red" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</RadioButton.Triggers>
</RadioButton>
<RadioButton Content="Green">
<RadioButton.Triggers>
<EventTrigger RoutedEvent="RadioButton.Checked">
<BeginStoryboard>
<Storyboard>
<ColorAnimation
Storyboard.TargetName="window"
Storyboard.TargetProperty="Background.Color"
Duration="0:0:1"
To="Green" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</RadioButton.Triggers>
</RadioButton>
<RadioButton Content="Blue">
<RadioButton.Triggers>
<EventTrigger
RoutedEvent="RadioButton.Checked">
<BeginStoryboard>
<Storyboard>
<ColorAnimation
Storyboard.TargetName="window"
Storyboard.TargetProperty="Background.Color"
Duration="0:0:1"
To="Blue" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</RadioButton.Triggers>
</RadioButton>
</StackPanel>
</Window>
728x90
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] AnimationClock 클래스 사용하기 (0) | 2015.10.01 |
---|---|
[C#/WPF] ControllableStoryboardAction 엘리먼트 사용하기 (0) | 2015.10.01 |
[C#/WPF] Storyboard 엘리먼트 : TargetProperty 속성 사용하기 (0) | 2015.10.01 |
[C#/WPF] Trigger 엘리먼트 : EnterActions/ExitActions 속성 사용하기 (0) | 2015.10.01 |
[C#/WPF] EventTrigger 엘리먼트 : 마우스 진입/이탈시 버튼 폰트 크기 변경하기 (0) | 2015.10.01 |
[C#/WPF] ParallelTimeline 엘리먼트 사용하기 (0) | 2015.09.29 |
[C#/WPF] Storyboard 엘리먼트 : TargetProperty 첨부 속성 설정하기 (0) | 2015.09.29 |
[C#/WPF] Storyboard 엘리먼트 사용하기 (0) | 2015.09.29 |
[C#/WPF] EventTrigger 엘리먼트 : 버튼 클릭시 버튼 폰트 크기 변경하기 (0) | 2015.09.29 |
[C#/WPF] Viewport3D 엘리먼트 : 3D 삼각형 만들기 (0) | 2015.09.27 |