728x90
728x170
▶ MainWindow.xaml
<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="Trigger 클래스 : Property 속성을 사용해 애니메이션 사용하기"
FontFamily="나눔고딕코딩"
FontSize="16">
<Window.Resources>
<Style x:Key="ButtonStyleKey" TargetType="{x:Type Button}">
<Setter Property="Opacity" Value="0.25" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty="Opacity"
To="0.25"
Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid>
<Button
Style="{StaticResource ButtonStyleKey}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Padding="10">
마우스를 버튼 위로 이동시켜 주세요.
</Button>
</Grid>
</Window>
728x90
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] BitmapImage 클래스 : 이미지 파일 로드하기 (0) | 2020.07.29 |
---|---|
[C#/WPF] BitmapMetadata 클래스 : 이미지 파일 생성시 파일 정보 저장하기 (0) | 2020.07.28 |
[C#/WPF] TiffBitmapEncoder 클래스 : 기존 이미지를 사용해 TIFF 파일 생성하기 (0) | 2020.07.28 |
[C#/WPF] TiffBitmapDecoder 클래스 : TIFF 이미지 파일 로드하기 (0) | 2020.07.28 |
[C#/WPF] TiffBitmapEncoder 클래스 : TIFF 파일 생성하기 (0) | 2020.07.28 |
[C#/WPF] EventTrigger 클래스 : RoutedEvent 속성을 사용해 애니메이션 사용하기 (0) | 2020.07.27 |
[C#/WPF] Adorner 클래스 : 단순 어도너 사용하기 (0) | 2020.07.27 |
[C#/WPF] Adorner 클래스 : 크기 조정 어도너 사용하기 (0) | 2020.07.27 |
[C#/WPF] AccessText 클래스 : 액세스 텍스트 사용하기 (0) | 2020.07.27 |
[C#/WPF] DrawingVisual 클래스 : 비주얼 자식 추가하기 (0) | 2020.07.27 |