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,位于命名ValueStates中VisualStateGroup。 其他两个状态(名称和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
注解
该 TemplateVisualStateAttribute.Name 属性对应于 VisualState.Name 一个 VisualState. 的属性。 若要指定 VisualState 属于控件 ControlTemplate的内容,请设置属性 TemplateVisualStateAttribute.Name 。