-1
我尝试将动画添加到WPF Window
的高度和宽度。 我看到我应该使用DoubleAnimation
中的属性EnableDependentAnimation
。此属性在WPF项目中未启用,但仅适用于Universal Window Application项目,为什么?为什么DoubleAnimation中的EnableDependentAnimation属性在WPF中不存在
我尝试将动画添加到WPF Window
的高度和宽度。 我看到我应该使用DoubleAnimation
中的属性EnableDependentAnimation
。此属性在WPF项目中未启用,但仅适用于Universal Window Application项目,为什么?为什么DoubleAnimation中的EnableDependentAnimation属性在WPF中不存在
WPF中没有EnableDependentAnimation属性可用,因为WPF没有“从属”动画的概念。
你仍然可以动态显示窗口的大小,但:
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication1"
mc:Ignorable="d"
Title="Window1" Height="300" Width="300" x:Name="myWindow">
<Window.Triggers>
<EventTrigger RoutedEvent="Loaded">
<EventTrigger.Actions>
<BeginStoryboard >
<Storyboard RepeatBehavior="Forever" AutoReverse="False">
<DoubleAnimation Storyboard.TargetProperty = "Height" To="500" Duration="0:0:5"/>
<Storyboard RepeatBehavior="Forever" AutoReverse="False">
<DoubleAnimation Storyboard.TargetProperty="Width" To="500" Duration="0:0:5"/>
</Storyboard>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Window.Triggers>