VisualStateGroup.States プロパティ

定義

同時に指定できない VisualState オブジェクトのコレクションを取得します。

public:
 property System::Collections::IList ^ States { System::Collections::IList ^ get(); };
public System.Collections.IList States { get; }
member this.States : System.Collections.IList
Public ReadOnly Property States As IList

プロパティ値

IList

同時に指定できない VisualState オブジェクトのコレクション。

次の例では、1 つGridを含む a Button の単純なControlTemplateオブジェクトを作成します。 また、状態と状態を VisualStateGroup 定義する名前付き CommonStatesMouseOverNormal まれています。 また VisualStateGroup 、ユーザーがマウス ポインターを VisualTransition 上に移動したときに緑から赤に変わるのに 1/2 秒 Grid かかることを指定する Buttona もあります。

<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>

適用対象