Represents the visual appearance of the control when it is in a specific state.
Assembly: PresentationFramework (in PresentationFramework.dll)
Gets a value that indicates whether this instance is currently sealed (read-only).(Inherited from DependencyObject.)
Gets or sets the name of the.
Gets or sets a Storyboard that defines the appearance of the control when it is in the state that is represented by the .
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)
Re-evaluates the effective value for the specified dependency property(Inherited from DependencyObject.)
Returns the local value of a dependency property, if it exists. (Inherited from DependencyObject.)
Sets the value of a dependency property without changing its value source. (Inherited from DependencyObject.)
Sets the local value of a dependency property, specified by its dependency property identifier. (Inherited from DependencyObject.)
Returns a value that indicates whether serialization processes should serialize the value for the provided dependency property.(Inherited from DependencyObject.)
Returns a string that represents the current object.(Inherited from Object.)
A Button is pressed, its border might be a different color than normal. The class has a Storyboard property that changes the appearance of the control. When the control enters the state that is specified by the VisualState.Name property, the Storyboard begins. When the control exits the state, the Storyboard stops.specifies how the control looks when it is in a certain state. For example, when a
The VisualStateGroup.States property contains objects. VisualStateGroup objects are added to the VisualStateManager.VisualStateGroups attached property, which is defined on the on a FrameworkElement. You can add objects to any FrameworkElement, but they are typically are used in a ControlTemplate of a Control. For information about how to create a ControlTemplate and objects for existing controls, see Customizing the Appearance of an Existing Control by Creating a ControlTemplate. For an example of using objects outside of a ControlTemplate, see the VisualStateManager class.
The following example creates a VisualStateGroup in the ControlTemplate of a Button called CommonStates and adds objects for the states, Normal, Pressed, and MouseOver. The Button also defines a state called Disabled that is in the CommonStatesVisualStateGroup, but the example omits it for brevity. For the entire example, see Customizing the Appearance of an Existing Control by Creating a ControlTemplate.
<!--Define the states and transitions for the common states. The states in the VisualStateGroup are mutually exclusive to each other.--> <VisualStateGroup Name="CommonStates"> <!--The Normal state is the state the button is in when it is not in another state from this VisualStateGroup.--> <VisualState Name="Normal" /> <!--Change the SolidColorBrush, BorderBrush, to red when the mouse is over the button.--> <VisualState Name="MouseOver"> <Storyboard> <ColorAnimation Storyboard.TargetName="BorderBrush" Storyboard.TargetProperty="Color" To="Red" /> </Storyboard> </VisualState> <!--Change the SolidColorBrush, BorderBrush, to Transparent when the button is pressed.--> <VisualState Name="Pressed"> <Storyboard> <ColorAnimation Storyboard.TargetName="BorderBrush" Storyboard.TargetProperty="Color" To="Transparent"/> </Storyboard> </VisualState> <!--The Disabled state is omitted for brevity.--> </VisualStateGroup> </VisualStateManager.VisualStateGroups>
Available since 4.0
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.