共用方式為


VisualTransition.Storyboard 屬性

定義

取得或設定會於轉換發生時發生的 Storyboard

public:
 property System::Windows::Media::Animation::Storyboard ^ Storyboard { System::Windows::Media::Animation::Storyboard ^ get(); void set(System::Windows::Media::Animation::Storyboard ^ value); };
public System.Windows.Media.Animation.Storyboard Storyboard { get; set; }
member this.Storyboard : System.Windows.Media.Animation.Storyboard with get, set
Public Property Storyboard As Storyboard

屬性值

Storyboard

會於轉換發生時發生的 Storyboard

範例

下列範例會建立 , VisualTransition 指定當使用者將滑鼠從控制項移開時,控制項的框線會變更為藍色,然後變成黃色,然後在 1.5 秒內變成黑色。 如需整個範例,請參閱 建立 ControlTemplate 來自訂現有控制項的外觀

<!--Take one and a half seconds to transition from the
    MouseOver state to the Normal state. 
    Have the SolidColorBrush, BorderBrush, fade to blue, 
    then to yellow, and then to black in that time.-->
<VisualTransition From="MouseOver" To="Normal" 
                      GeneratedDuration="0:0:1.5">
  <Storyboard>
    <ColorAnimationUsingKeyFrames
      Storyboard.TargetProperty="Color"
      Storyboard.TargetName="BorderBrush"
      FillBehavior="HoldEnd" >

      <ColorAnimationUsingKeyFrames.KeyFrames>

        <LinearColorKeyFrame Value="Blue" 
          KeyTime="0:0:0.5" />
        <LinearColorKeyFrame Value="Yellow" 
          KeyTime="0:0:1" />
        <LinearColorKeyFrame Value="Black" 
          KeyTime="0:0:1.5" />

      </ColorAnimationUsingKeyFrames.KeyFrames>
    </ColorAnimationUsingKeyFrames>
  </Storyboard>
</VisualTransition>

備註

VisualTransition當 包含 Storyboard 時,每當套用 時 VisualTransition ,就會 Storyboard 執行 。 例如,如果您想要當使用者將滑鼠移開時變更色彩的 Button 框線,您可以建立 VisualTransition 具有 Storyboard 變更按鈕背景的 。

適用於