TemplateVisualStateAttribute.GroupName 屬性

定義

取得或設定狀態所屬的群組之名稱。

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

屬性值

String

狀態所屬之 VisualStateGroup 的名稱。

範例

下列範例顯示 控制項的 NumericUpDown 類別簽章。 這個範例會 NumericUpDown 指定控制項使用四個視覺狀態。 名為 和 Negative 的兩個狀態 Positive 位於 VisualStateGroup 具名 ValueStates 的 中。 其他兩個狀態 name FocusedUnfocused 位於名為 FocusedStatesVisualStateGroup 中。 如需整個範例,請參閱 建立具有可自訂外觀的控制項

[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

備註

屬性 GroupName 會對應至 VisualStateGroup.Name 物件的 屬性 VisualStateGroup 。 若要指定 所屬的專案 VisualStateGroup VisualState ,請設定 GroupName 屬性。

適用於