自定义「属性故事面板」与「属性设置动画」

This commit is contained in:
于智纯
2025-09-07 21:09:03 +08:00
parent 7212a7dea7
commit a023c7f6cb
3 changed files with 90 additions and 1 deletions

View File

@@ -30,7 +30,8 @@
<ControlTemplate TargetType="{x:Type local:StateAdornerDecorator}">
<!--使用「装饰器」容器做为控件模板的根对象,保证当前控件可以为任何控件提供装饰层-->
<AdornerDecorator>
<Border BorderBrush="{TemplateBinding BorderBrush}"
<Border x:Name="dtRoot"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Border.Background>
<SolidColorBrush x:Name="BackgroundBrush" Color="White"/>
@@ -50,6 +51,7 @@
<VisualState x:Name="Selected">
<Storyboard>
<!--状态切换动画-->
<local:PropertySetterAnimation Storyboard.TargetName="dtRoot" Storyboard.TargetProperty="Background" Value="Red" Duration="0:0:0"/>
</Storyboard>
</VisualState>
<VisualState x:Name="NormalHover">