示例代码:

<Window.Style>
    <Style TargetType="{x:Type Window}">
        <Setter Property="WindowState"  Value="{Binding Tag, RelativeSource={RelativeSource Mode=Self}, UpdateSourceTrigger=PropertyChanged,Delay=100}"/>
        <Style.Triggers>
            <Trigger Property="WindowState" Value="Maximized">
                <Trigger.EnterActions>
                    <BeginStoryboard x:Name="bs">
                        <Storyboard Storyboard.TargetProperty="Tag"    Duration="0:0:0" >
                            <ObjectAnimationUsingKeyFrames>
                                <DiscreteObjectKeyFrame KeyTime="0:0:0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <WindowState>normal</WindowState>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </BeginStoryboard>
                </Trigger.EnterActions>
                <Trigger.ExitActions>
                    <RemoveStoryboard BeginStoryboardName="bs"/>
                </Trigger.ExitActions>
            </Trigger>
        </Style.Triggers>
    </Style>
</Window.Style>

 

相关文章:

  • 2021-07-17
  • 2021-11-26
  • 2021-04-28
  • 2021-12-23
  • 2022-12-23
  • 2021-08-05
  • 2022-12-23
猜你喜欢
  • 2021-10-09
  • 2021-09-21
  • 2022-12-23
  • 2021-08-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案