【问题标题】:Why EnableDependentAnimation property in DoubleAnimation does not exist in WPF为什么WPF中不存在DoubleAnimation中的EnableDependentAnimation属性
【发布时间】:2016-12-15 10:15:17
【问题描述】:

我尝试将动画添加到 WPF Window 的高度和宽度。 我看到我应该在DoubleAnimation 中使用属性EnableDependentAnimation。 WPF项目中没有启用这个属性,只有通用窗口应用项目,为什么?

【问题讨论】:

    标签: wpf xaml doubleanimation


    【解决方案1】:

    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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-10-31
      • 2013-05-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多