WPF 使用動畫設置特殊值的方法

例如設置Visibility屬性時:spa

第一種方式:code

<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"  FillBehavior="HoldEnd" Storyboard.TargetName="grid">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Hidden}"/>
                <DiscreteObjectKeyFrame KeyTime="0:0:0.3" Value="{x:Static Visibility.Visible}"/>
            </ObjectAnimationUsingKeyFrames>

也就是使用static關鍵字來賦值。blog

 

第二種方式get

<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"  FillBehavior="HoldEnd" Storyboard.TargetName="grid">
 <DiscreteObjectKeyFrame KeyTime="0" >
                    <DiscreteObjectKeyFrame.Value>
                        <Visibility>Visible</Visibility>
                    </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
               
            </ObjectAnimationUsingKeyFrames>

手動設置要設置的值。it

相關文章
相關標籤/搜索