VisualState クラス

定義

コントロールが特定の状態のときの外観を表します。

public ref class VisualState : System::Windows::DependencyObject
[System.Windows.Markup.ContentProperty("Storyboard")]
[System.Windows.Markup.RuntimeNameProperty("Name")]
public class VisualState : System.Windows.DependencyObject
[<System.Windows.Markup.ContentProperty("Storyboard")>]
[<System.Windows.Markup.RuntimeNameProperty("Name")>]
type VisualState = class
    inherit DependencyObject
Public Class VisualState
Inherits DependencyObject
継承
属性

次の例では、呼び出されたオブジェクトの中に 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>

注釈

A VisualState は、コントロールが特定の状態にある場合の外観を指定します。 たとえば、a Button を押すと、境界線の色が通常とは異なる場合があります。 この VisualState クラスには、 Storyboard コントロールの外観を変更するプロパティがあります。 コントロールがプロパティで VisualState.Name 指定された状態になると、 Storyboard 開始されます。 コントロールが状態を終了すると、停止します Storyboard

プロパティには VisualStateGroup.States オブジェクトが VisualState 含まれています。 VisualStateGroup オブジェクトは添付プロパティに VisualStateManager.VisualStateGroups 追加されます。このプロパティは FrameworkElement、 オブジェクトは任意FrameworkElementのオブジェクトに追加VisualStateできますが、通常はオブジェクトのControlControlTemplateで使用されます。 既存のコントロールとオブジェクトを作成する方法については、「ControlTemplate を作成して既存のコントロールの外観をカスタマイズする」を参照してください。ControlTemplate VisualState 外部ControlTemplateのオブジェクトを使用VisualStateする例については、クラスをVisualStateManager参照してください。

コンストラクター

VisualState()

VisualState クラスの新しいインスタンスを初期化します。

プロパティ

DependencyObjectType

このインスタンスの DependencyObjectType CLR 型をラップする値を取得します。

(継承元 DependencyObject)
Dispatcher

この Dispatcher が関連付けられている DispatcherObject を取得します。

(継承元 DispatcherObject)
IsSealed

このインスタンスが現在シールされている (読み取り専用である) かどうかを示す値を取得します。

(継承元 DependencyObject)
Name

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

Storyboard

コントロールが Storyboard で表される状態のときに、コントロールの外観を定義する VisualState を取得または設定します。

メソッド

CheckAccess()

呼び出し元のスレッドがこの DispatcherObject にアクセスできるかどうかを確認します。

(継承元 DispatcherObject)
ClearValue(DependencyProperty)

プロパティのローカル値をクリアします。 クリアするプロパティは DependencyProperty 識別子で指定されます。

(継承元 DependencyObject)
ClearValue(DependencyPropertyKey)

読み取り専用プロパティのローカル値を消去します。 消去するプロパティは、DependencyPropertyKey で指定します。

(継承元 DependencyObject)
CoerceValue(DependencyProperty)

指定した依存関係プロパティの値を強制します。 これは、呼び出し元の DependencyObject の依存関係プロパティのプロパティ メタデータで指定されている CoerceValueCallback 関数を呼び出すことによって実現されます。

(継承元 DependencyObject)
Equals(Object)

指定した DependencyObject が現在の DependencyObject と等しいかどうかを判断します。

(継承元 DependencyObject)
GetHashCode()

この DependencyObject のハッシュ コードを取得します。

(継承元 DependencyObject)
GetLocalValueEnumerator()

どの依存関係プロパティがこの DependencyObject 上にローカルに設定された値を持つかを確認するための、専用の列挙子を作成します。

(継承元 DependencyObject)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
GetValue(DependencyProperty)

DependencyObject のこのインスタンスにある依存関係プロパティの現在の有効値を返します。

(継承元 DependencyObject)
InvalidateProperty(DependencyProperty)

指定した依存関係プロパティの有効値を再評価します。

(継承元 DependencyObject)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
OnPropertyChanged(DependencyPropertyChangedEventArgs)

この DependencyObject の依存関係プロパティの有効値が更新された場合に必ず呼び出されます。 変更された特定の依存関係プロパティは、イベント データで報告されます。

(継承元 DependencyObject)
ReadLocalValue(DependencyProperty)

ローカルの依存関係プロパティの値を返します (存在する場合)。

(継承元 DependencyObject)
SetCurrentValue(DependencyProperty, Object)

依存関係プロパティ値のソースを変更せずにその値を設定します。

(継承元 DependencyObject)
SetValue(DependencyProperty, Object)

依存関係プロパティ識別子を指定して、該当する依存関係プロパティのローカル値を設定します。

(継承元 DependencyObject)
SetValue(DependencyPropertyKey, Object)

依存関係プロパティの DependencyPropertyKey 識別子で指定した読み取り専用の依存関係プロパティのローカル値を設定します。

(継承元 DependencyObject)
ShouldSerializeProperty(DependencyProperty)

シリアル化プロセスが、指定された依存関係プロパティの値をシリアル化する必要があるかどうかを示す値を返します。

(継承元 DependencyObject)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)
VerifyAccess()

呼び出し元のスレッドがこの DispatcherObject にアクセスできるように強制します。

(継承元 DispatcherObject)

適用対象