VisualState.Name プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
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
プロパティ値
VisualState の名前。
例
次の例では、呼び出されたオブジェクトの中に ControlTemplate a VisualStateGroup をButton作成しVisualState、状態、、Normal
および Pressed``MouseOver
.CommonStates
またButton、その中にあるCommonStates
VisualStateGroupと呼ばれる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