摘要:[Windows App 開發] 常見的 Animate 使用方法
顏色類 (Background/Foreground/BorderBrush),以 Background 為例
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="TargetControl">
<DiscreteObjectKeyFrame KeyTime="0" Value="#FFFFFF"/>
</ObjectAnimationUsingKeyFrames>
數值類 (Opacity/Width/Height/),以 Opacity 為例
<DoubleAnimation
Storyboard.TargetName="TargetControl"
Storyboard.TargetProperty="Opacity" From="1.0" To="0.8" Duration="0:0:0.3" />
邊界類 (Margin/Padding/BorderThickess),以 Margin 為例
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TargetControl" Storyboard.TargetProperty="Margin">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Thickness>
300,0,0,0
</Thickness>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
Enum 類 (Visibility/SelectionMode),以 Visibility 為例
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TargetControl" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame Value="Collapsed" KeyTime="0"/>
</ObjectAnimationUsingKeyFrames>