저는 WPF 및 XAML에 새로운 것이므로 사용자 지정 단추 스타일을 만들려고합니다.XAML에서 테두리 두께 변경
<Style x:Key="RoundButtonTemplate" TargetType="Button">
<Setter Property="Background" Value="LightBlue"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="Test" CornerRadius="5" Background="{TemplateBinding Background}"
BorderThickness="1" BorderBrush="Blue">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center">
</ContentPresenter>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
그리고 버튼을 떠오르게 litte 애니메이션 :
<Style x:Key="Animation" TargetType="Button" BasedOn="{StaticResource RoundButtonTemplate}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation
Storyboard.TargetProperty="BorderThickness"
Duration="0:0:0.400"
From="1, 1, 1, 1"
To="3, 3, 3, 3"/>
<DoubleAnimation
Storyboard.TargetProperty="Height"
Duration="0:0:0.300"
From="22"
To="25"/>
<DoubleAnimation
Storyboard.TargetProperty="Width"
Duration="0:0:0.300"
From="75"
To="78"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</Style>
모두가 ThicknessAnimation 제외하고 잘 작동
는 이미 버튼 템플릿을 가지고있다. 어떻게 작동할까요?
당신이 ThicknessAnimation – grabthefish