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当包含 a Storyboard时,每当应用该命令时VisualTransition运行Storyboard。 例如,如果希望在用户将鼠标移开时更改颜色的边框,则可以创建具有更改按钮背景的Storyboard边框ButtonVisualTransition

适用于