VisualState.Storyboard Свойство

Определение

Получает или задает объект Storyboard , определяющий внешний вид элемента управления, когда он находится в состоянии, представленном этим VisualStateэлементом.

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

Значение свойства

Раскадровка, определяющая внешний вид элемента управления, когда он находится в состоянии, представленном этим элементом VisualState. Значение по умолчанию — null.

Примеры

В следующем примере создается простой ControlTemplate объект, Button содержащий один Grid. Вызывается VisualState раскадровка, которая изменяет цвет Grid с зеленого на красный, когда пользователь помещает указатель мыши на ButtonMouseOver него. Вызывается VisualStateNormal таким образом, Grid что при перемещении мыши с кнопки возвращается зеленый цвет.

<ControlTemplate TargetType="Button">
  <Grid >
    <VisualStateManager.VisualStateGroups>
      <VisualStateGroup x:Name="CommonStates">

        <VisualStateGroup.Transitions>

          <!--Take one half second to trasition to the MouseOver state.-->
          <VisualTransition To="MouseOver" 
            GeneratedDuration="0:0:0.5"/>
        </VisualStateGroup.Transitions>

        <VisualState x:Name="Normal" />

        <!--Change the SolidColorBrush, ButtonBrush, to red when the
            mouse is over the button.-->
        <VisualState x:Name="MouseOver">
          <Storyboard>
            <ColorAnimation Storyboard.TargetName="ButtonBrush" 
              Storyboard.TargetProperty="Color" To="Red" />
          </Storyboard>
        </VisualState>
      </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>
    <Grid.Background>
      <SolidColorBrush x:Name="ButtonBrush" Color="Green"/>
    </Grid.Background>
  </Grid>
</ControlTemplate>

Комментарии

Когда элемент управления вводит состояние, указанное VisualState.Name свойством, Storyboard начинается. Когда элемент управления выходит из состояния, Storyboard останавливается.

Применяется к