VisualState.Name プロパティ

定義

VisualState の名前を取得または設定します。

public:
 property System::String ^ Name { System::String ^ get(); void set(System::String ^ value); };
public string Name { get; set; }
member this.Name : string with get, set
Public Property Name As String

プロパティ値

String

VisualState の名前。

次の例では、呼び出されたオブジェクトの中に ControlTemplate a VisualStateGroupButton作成しVisualState、状態、、Normalおよび Pressed``MouseOver.CommonStates またButton、その中にあるCommonStatesVisualStateGroupと呼ばれるDisabled状態も定義しますが、簡潔にするために省略しています。 例全体については、「 ControlTemplate を作成して既存のコントロールの外観をカスタマイズする」を参照してください。

  <!--Define the states and transitions for the common states.
      The states in the VisualStateGroup are mutually exclusive to
      each other.-->
  <VisualStateGroup x:Name="CommonStates">

    <!--The Normal state is the state the button is in
        when it is not in another state from this VisualStateGroup.-->
    <VisualState x:Name="Normal" />

    <!--Change the SolidColorBrush, BorderBrush, to red when the
        mouse is over the button.-->
    <VisualState x:Name="MouseOver">
      <Storyboard>
        <ColorAnimation Storyboard.TargetName="BorderBrush" 
                        Storyboard.TargetProperty="Color" 
                        To="Red" />
      </Storyboard>
    </VisualState>

    <!--Change the SolidColorBrush, BorderBrush, to Transparent when the
        button is pressed.-->
    <VisualState x:Name="Pressed">
      <Storyboard>
        <ColorAnimation Storyboard.TargetName="BorderBrush" 
                        Storyboard.TargetProperty="Color"
                        To="Transparent"/>
      </Storyboard>
    </VisualState>

    <!--The Disabled state is omitted for brevity.-->
  </VisualStateGroup>
</VisualStateManager.VisualStateGroups>

注釈

要素が入力するビジュアル状態を指定するには、次のVisualState値を .Name VisualStateManager

in をControl VisualStateManager ControlTemplate使用する場合、コントロール作成者は、クラス シグネチャを配置することで、コントロールが検索ControlTemplateするオブジェクトをTemplateVisualStateAttribute指定VisualStateする必要があります。 ControlTemplate 作成者は新しい VisualState オブジェクトを定義し、プロパティで Name 指定された値にプロパティを TemplateVisualStateAttribute.Name 設定します。

WPF に含まれるコントロールの表示状態の名前については、「 コントロールのスタイルとテンプレート」を参照してください。 既存のコントロールとオブジェクトを作成する方法については、「ControlTemplate を作成して既存のコントロールの外観をカスタマイズする」を参照してください。ControlTemplate VisualState

適用対象