TemplateVisualStateAttribute クラス

定義

コントロールが取ることのできる状態と、そのコントロールの VisualStateControlTemplate を追加できることを指定します。

public ref class TemplateVisualStateAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=true)]
public sealed class TemplateVisualStateAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=true)>]
type TemplateVisualStateAttribute = class
    inherit Attribute
Public NotInheritable Class TemplateVisualStateAttribute
Inherits Attribute
継承
TemplateVisualStateAttribute
属性

次の例は、 コントロールのクラス シグネチャを NumericUpDown 示しています。 この例では、コントロールが 4 つのビジュアル状態を NumericUpDown 使用することを指定します。 と という名前PositiveNegativeの 2 つの状態は、 という名前ValueStatesの にありますVisualStateGroup。 他の 2 つの状態である name FocusedUnfocusedは、名前付きの FocusedStatesにありますVisualStateGroup。 例全体については、「 カスタマイズ可能な外観を持つコントロールの作成」を参照してください。

[TemplatePart(Name = "UpButtonElement", Type = typeof(RepeatButton))]
[TemplatePart(Name = "DownButtonElement", Type = typeof(RepeatButton))]
[TemplateVisualState(Name = "Positive", GroupName = "ValueStates")]
[TemplateVisualState(Name = "Negative", GroupName = "ValueStates")]
[TemplateVisualState(Name = "Focused", GroupName = "FocusedStates")]
[TemplateVisualState(Name = "Unfocused", GroupName = "FocusedStates")]
public class NumericUpDown : Control
<TemplatePart(Name:="UpButtonElement", Type:=GetType(RepeatButton))> _
<TemplatePart(Name:="DownButtonElement", Type:=GetType(RepeatButton))> _
<TemplateVisualState(Name:="Positive", GroupName:="ValueStates")> _
<TemplateVisualState(Name:="Negative", GroupName:="ValueStates")> _
<TemplateVisualState(Name:="Focused", GroupName:="FocusedStates")> _
<TemplateVisualState(Name:="Unfocused", GroupName:="FocusedStates")> _
Public Class NumericUpDown
    Inherits Control

注釈

コントロール作成者は、この属性を使用して、コントロールControlTemplateVisualState に属する オブジェクトと VisualStateGroup オブジェクトを指定します。 たとえば、 と という名前Focusedの 2 つのビジュアル状態を持つ新しいコントロールを作成するとします。どちらも という名前FocusStatesの 内にありますVisualStateGroupUnfocused これらのビジュアル状態を使用できることを作成者に ControlTemplate 指定するには、コントロールのクラス シグネチャに 2 つの TemplateVisualStateAttribute 属性を追加します。 プロパティが GroupName でありFocusStates、プロパティがFocusedName一方用Unfocusedと他方用であることを指定します。

コンストラクター

TemplateVisualStateAttribute()

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

プロパティ

GroupName

状態が属するグループの名前を取得または設定します。

Name

コントロールが取ることのできる状態の名前を取得または設定します。

TypeId

派生クラスで実装されると、この Attribute の一意の識別子を取得します。

(継承元 Attribute)

メソッド

Equals(Object)

このインスタンスが、指定されたオブジェクトと等価であるかどうかを示す値を返します。

(継承元 Attribute)
GetHashCode()

このインスタンスのハッシュ コードを返します。

(継承元 Attribute)
GetType()

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

(継承元 Object)
IsDefaultAttribute()

派生クラスでオーバーライドされるとき、このインスタンスの値が派生クラスの既定値であるかどうかを示します。

(継承元 Attribute)
Match(Object)

派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。

(継承元 Attribute)
MemberwiseClone()

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

(継承元 Object)
ToString()

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

(継承元 Object)

明示的なインターフェイスの実装

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

一連の名前を対応する一連のディスパッチ識別子に割り当てます。

(継承元 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

オブジェクトの型情報を取得します。この情報はインターフェイスの型情報の取得に使用できます。

(継承元 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。

(継承元 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

オブジェクトによって公開されたプロパティおよびメソッドへのアクセスを提供します。

(継承元 Attribute)

適用対象