例如設置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