Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

VisualState.Name Property

Gets the name of the VisualState.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)
public string Name { get; }
<VisualState x:Name="stateName"/>

XAML Values

stateName

The name of the VisualState. Name is a read-only property, so specify the name of the VisualState by setting x:Name.

Property Value

Type: System.String
The name of the VisualState.

Control authors specify which VisualState objects the control expects to find in its ControlTemplate by putting the TemplateVisualStateAttribute on its class signature. ControlTemplate authors define new VisualState objects and set the Name property to the value specified by the TemplateVisualStateAttribute.Name property. For information about how to create a ControlTemplate and VisualState objects for existing controls, see Customizing the Appearance of an Existing Control by Using a ControlTemplate.

The following example creates a VisualStateGroup in the ControlTemplate of a Button called CommonStates and adds VisualState objects for the states, Normal, Pressed, and MouseOver. The Button also defines a state called Disabled that is in the CommonStates VisualStateGroup, but the example omits it for brevity. For the entire example, see Customizing the Appearance of an Existing Control by Using a ControlTemplate.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.