Edit

Bagikan melalui


TemplateVisualStateAttribute.Name Property

Definition

Gets or sets the name of the state that the control can be in.

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

Property Value

The name of the state that the control can be in.

Examples

The following example shows the class signature for the NumericUpDown control. This example specifies that the NumericUpDown control uses four visual states. Two states, named Positive and Negative, are in the VisualStateGroup named ValueStates. The other two states, name Focused and Unfocused, are in the VisualStateGroup named FocusedStates. For the entire example, see Creating a Control That Has a Customizable Appearance.

[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

Remarks

The TemplateVisualStateAttribute.Name property corresponds to the VisualState.Name property of a VisualState. To specify what VisualState belongs in a control's ControlTemplate, set the TemplateVisualStateAttribute.Name property.

Applies to