TemplateVisualStateAttribute.Name 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定控制點可處於的狀態名稱。
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
屬性值
控制可以所在的州名稱。
範例
以下範例顯示控制項的 NumericUpDown 類別簽章。 此範例說明 NumericUpDown 控制使用四種視覺狀態。 兩個狀態,名為 Positive 和 Negative,位於 VisualStateGroup 命名 ValueStates中。 另外兩個狀態,名稱 Focused 和 Unfocused,則位於 VisualStateGroup 已命名 FocusedStates的 中。 完整範例請參見 「建立具有可自訂外觀的控制項」。
[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
備註
該 TemplateVisualStateAttribute.Name 性質對 VisualState.Name 應於 VisualState的性質。 若要指定控制項中屬於什麼VisualState,設定ControlTemplateTemplateVisualStateAttribute.Name屬性。