VisualStateManager VisualStateManager VisualStateManager Class

Manages visual states and the logic for transitions between visual states for controls. Also provides the attached property support for VisualStateManager.VisualStateGroups, which is how you define visual states in XAML for a control template.

Syntax

Declaration

public class VisualStateManagerpublic class VisualStateManagerPublic Class VisualStateManager

Inheritance Hierarchy

Remarks

VisualStateManager supports two important features for control authors, and for app developers who are applying a custom template to a control:

  • Control authors or app developers add VisualStateGroup object elements to the root element of a control template definition in XAML, using the VisualStateManager.VisualStateGroups attached property. Within a VisualStateGroup element, each VisualState represents a discrete visual state of a control. Each VisualState has a name that is representative of a UI state that can be changed by the user, or changed by control logic. A VisualState consists mainly of a Storyboard. This Storyboard targets individual dependency property values that should be applied whenever the control is in that visual state. For more info on how to write visual states in XAML, including example code, see Storyboarded animations for visual states.
  • Control authors or app developers transition between these states by calling the static GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean) method of VisualStateManager. Control authors do this whenever the control logic handles events that indicate a change of state, or control logic initiates a state change by itself. It's more common for control definition code to do this rather than app code, so that all the possible visual states and their transitions and trigger conditions are there by default for app code, and the logic is encapsulated by the control.

Most developers will use just two of the VisualStateManager API: VisualStateManager.VisualStateGroups, and GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean), as described above. The remaining API are all for extension support and creating a custom VisualStateManager. For more info see "Custom VisualStateManager" section in this topic.

When you edit copies of styles as enabled by the XAML design surface of Microsoft Visual Studio, the visual states from the default template are defined in the XAML you are editing. Make sure you don't delete these states or change their names, because the control logic is expecting that these visual states exist in the template.

In addition to the visual states, the visual state model also includes transitions. Transitions are animation actions controlled by a Storyboard that occur between each visual state when the state is changed. The transition can be defined differently for each combination of starting state and ending state as defined by your control's set of visual states. Transitions are defined by the Transitions property of VisualStateGroup, in XAML using property element syntax. Most default control templates don't define transitions. In absence of specifically defined transitions, the transitions between states happen instantaneously (zero-duration). For more info, see VisualTransition.

Attached properties defined by VisualStateManager

@Windows.UI.Xaml.VisualStateManager.#ctor supports these XAML attached properties: + VisualStateManager.VisualStateGroups (a collection)

Custom VisualStateManager

As an advanced scenario, it is possible to derive from VisualStateManager and change the default GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean) behavior. Follow these guidelines:

That's the basic requirements for creating and using a custom VisualStateManager. You also can choose to override a few more behaviors:

All the other API (CustomVisualStateManagerProperty, GetCustomVisualStateManager(Windows.UI.Xaml.FrameworkElement), GetVisualStateGroups(Windows.UI.Xaml.FrameworkElement), SetCustomVisualStateManager(Windows.UI.Xaml.FrameworkElement,Windows.UI.Xaml.VisualStateManager) ) are infrastructure for attached property support, and you don't need to call them or do anything with them.

Visual states for elements that aren't controls

Visual states are sometimes useful for scenarios where you want to change the state of some area of UI that's not immediately a Control subclass. You can't do this directly because the control parameter of the GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean) method requires a Control subclass, which refers to the object that the VisualStateManager acts upon. Page is a Control subclass, and it's fairly rare that you'd be showing UI in a context where you don't have a Page, or your Content root isn't a Control subclass. We recommend you define a custom UserControl to either be the Content root or be a container for other content you want to apply states to (such as a Panel ). Then you can call GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean) on your UserControl and apply states regardless of whether the rest of the content is a Control. For example you could apply visual states to UI that otherwise consists of just a SwapChainPanel so long as you placed that within your UserControl and declared named states that apply to the properties of the parent UserControl or of the named SwapChainPanel part of the template.

Examples

This example shows how to use the VisualStateManager.VisualStateGroups XAML attached property. Note how there is otherwise no "VisualStateManager" tag defined. Conceptually, VisualStateManager.VisualStateGroups contains the visual states for a control, as an immediate child tag of the template root in a control template.

The particular set of visual states contains one VisualStateGroup, called "CommonStates", which defines the "PointerOver" and "Normal"**VisualState objects. When the user puts the pointer over the Button, the Grid changes from green to red in .5 seconds. When the user moves the pointer away from the button, the Grid immediately changes back to green.

<ControlTemplate TargetType="Button">
  <Grid >
    <VisualStateManager.VisualStateGroups>
      <VisualStateGroup x:Name="CommonStates">

        <VisualStateGroup.Transitions>

          <!--Take one half second to transition to the PointerOver state.-->
          <VisualTransition To="PointerOver" 
                              GeneratedDuration="0:0:0.5"/>
        </VisualStateGroup.Transitions>
        
        <VisualState x:Name="Normal" />

        <!--Change the SolidColorBrush, ButtonBrush, to red when the
            Pointer is over the button.-->
        <VisualState x:Name="PointerOver">
          <Storyboard>
            <ColorAnimation Storyboard.TargetName="ButtonBrush" 
                            Storyboard.TargetProperty="Color" To="Red" />
          </Storyboard>
        </VisualState>
      </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>
    <Grid.Background>
      <SolidColorBrush x:Name="ButtonBrush" Color="Green"/>
    </Grid.Background>
  </Grid>
</ControlTemplate>
<common:LayoutAwarePage>
  <Grid>
...
    <VisualStateManager.VisualStateGroups>
    <!-- Visual states reflect the application's window size -->
      <VisualStateGroup>
        <VisualState x:Name="DefaultLayout">
           <Storyboard>
           </Storyboard>
        </VisualState>
        <VisualState x:Name="Below768Layout">
           <Storyboard>
             <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)"
               Storyboard.TargetName="ContentRoot">
               <DiscreteObjectKeyFrame KeyTime="0">
                 <DiscreteObjectKeyFrame.Value>
                   <Thickness>20,20,20,20</Thickness>
                 </DiscreteObjectKeyFrame.Value>
               </DiscreteObjectKeyFrame>
             </ObjectAnimationUsingKeyFrames>
             <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)"
               Storyboard.TargetName="FooterPanel">
               <DiscreteObjectKeyFrame KeyTime="0">
                 <DiscreteObjectKeyFrame.Value>
                    <HorizontalAlignment>Left</HorizontalAlignment>
                 </DiscreteObjectKeyFrame.Value>
               </DiscreteObjectKeyFrame>
             </ObjectAnimationUsingKeyFrames>
           </Storyboard>
         </VisualState>
       </VisualStateGroup>
     </VisualStateManager.VisualStateGroups>
   </Grid>
</common:LayoutAwarePage>

The next snippet is code to go along with the XAML, showing how an app might detect the app window width and use that info to call the appropriate visual state.

String state = (Window.Current.Bounds.Width > 768) ? "DefaultLayout" : "Below768Layout";
VisualStateManager.GoToState(this, state, false); // 'this' is the LayoutAwarePage, scope is page code-behind

Constructors summary

Initializes a new instance of the VisualStateManager class.

Properties summary

Identifies the VisualStateManager.CustomVisualStateManager dependency property.

Methods summary

Gets the value of the CustomVisualStateManagerProperty attached property.

Gets the value of the VisualStateManager.VisualStateGroups attached property.

Transitions a control between two states, by requesting a new VisualState by name.

Sets the value of the CustomVisualStateManagerProperty attached property.

Constructors

  • VisualStateManager()
    VisualStateManager()
    VisualStateManager()
    VisualStateManager()

    Initializes a new instance of the VisualStateManager class.

    public VisualStateManager()public VisualStateManager()Public Function VisualStateManager() As

Properties

  • CustomVisualStateManagerProperty
    CustomVisualStateManagerProperty
    CustomVisualStateManagerProperty
    CustomVisualStateManagerProperty

    Identifies the VisualStateManager.CustomVisualStateManager dependency property.

    public static DependencyProperty CustomVisualStateManagerProperty { get; }public static DependencyProperty CustomVisualStateManagerProperty { get; }Public Static ReadOnly Property CustomVisualStateManagerProperty As DependencyProperty

    Property Value

Methods

  • GetCustomVisualStateManager(Windows.UI.Xaml.FrameworkElement)
    GetCustomVisualStateManager(Windows.UI.Xaml.FrameworkElement)
    GetCustomVisualStateManager(Windows.UI.Xaml.FrameworkElement)
    GetCustomVisualStateManager(Windows.UI.Xaml.FrameworkElement)

    Gets the value of the CustomVisualStateManagerProperty attached property.

    public static VisualStateManager GetCustomVisualStateManager(Windows.UI.Xaml.FrameworkElement)public static VisualStateManager GetCustomVisualStateManager(Windows.UI.Xaml.FrameworkElement)Public Static Function GetCustomVisualStateManager(Windows.UI.Xaml.FrameworkElement) As VisualStateManager

    Parameters

    Returns

    Remarks

    This API provides attached property support for XAML usages, and doesn't need to be changed in a custom VisualStateManager scenario.

  • GetVisualStateGroups(Windows.UI.Xaml.FrameworkElement)
    GetVisualStateGroups(Windows.UI.Xaml.FrameworkElement)
    GetVisualStateGroups(Windows.UI.Xaml.FrameworkElement)
    GetVisualStateGroups(Windows.UI.Xaml.FrameworkElement)

    Gets the value of the VisualStateManager.VisualStateGroups attached property.

    public static IVector<VisualStateGroup> GetVisualStateGroups(Windows.UI.Xaml.FrameworkElement)public static IVector<VisualStateGroup> GetVisualStateGroups(Windows.UI.Xaml.FrameworkElement)Public Static Function GetVisualStateGroups(Windows.UI.Xaml.FrameworkElement) As IVector( Of VisualStateGroup )

    Parameters

    Returns

    • The collection of VisualStateGroup objects that is associated with the specified object.

    Remarks

    This API provides attached property support for XAML usages, and doesn't need to be changed in a custom VisualStateManager scenario.

  • GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean)
    GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean)
    GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean)
    GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean)

    Transitions a control between two states, by requesting a new VisualState by name.

    public static bool GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean)public static bool GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean)Public Static Function GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean) As bool

    Parameters

    • control

      The control to transition between states.

    • stateName
      System.String
      System.String
      System.String

      The state to transition to.

    • useTransitions
      System.Boolean
      System.Boolean
      System.Boolean

      true to use a VisualTransition to transition between states. false to skip using transitions and go directly to the requested state. The default is false.

    Returns

    • bool
      bool
      bool

      true if the control successfully transitions to the new state, or was already using that state; otherwise, false.

    Remarks

    This method is used by control logic. You typically only need it if you are writing a custom control, or if you are using app-level logic for view states (such as refreshing your app content for changes in app window size or orientation).

    When you call this method, there is expected to be a VisualState with an x:Name value that matches your stateName value, somewhere in the control template for the control identified by control, or as a resource for your app. If there isn't, you don't get exceptions, but the return value will be false. The state named by stateName can be in any of the VisualStateGroup elements in the template for the specified Control. It's up to you to keep track of which states are in which VisualStateGroup and knowing which state gets unloaded when you specify a new state from that group.

    Typically the ControlTemplate that contains the visual states as referenced by name when using GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean) is not specifically defined for that control instance. Instead the visual states are from the default control style that's loaded as the implicit style for all instances of that control. For more info on the implicit style concept, see Quickstart: Control templates.

    VisualStateManager supports two important features for control authors, and for app developers who are applying a custom template to a control:

    • Control authors or app developers add VisualStateGroup object elements to the root element of a control template definition in XAML, using the VisualStateManager.VisualStateGroups attached property. Within a VisualStateGroup element, each VisualState represents a discrete visual state of a control. Each VisualState has a name that is representative of a UI state that can be changed by the user, or changed by control logic. A VisualState consists mainly of a Storyboard. This Storyboard targets individual dependency property values that should be applied whenever the control is in that visual state.
    • Control authors or app developers transition between these states by calling the static GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean) method of VisualStateManager. Control authors do this whenever the control logic handles events that indicate a change of state, or control logic initiates a state change by itself. It's more common for control definition code to do this rather than app code, so that all the possible visual states and their transitions and trigger conditions are there by default for app code. Or, it's the app code that is changing visual states, to manage app-level view states in response to user-driven changes to the size or orientation of the main app window.

    When you call GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean) to change the visual state of a control, the VisualStateManager performs these actions:

    • First it's determined whether a state that matches stateName exists. If not, nothing happens and the method returns false.
    • If the VisualState as named by stateName exists, and has a Storyboard, the storyboard begins.
    • If the VisualState that the control was using from that same VisualStateGroup prior to the newly requested state has a Storyboard, that storyboard stops. Other than the specific properties that the new VisualState applies an animation to, the control reverts to the initially loaded states from the control template and its composition.

    If the control is already in the VisualState requested as stateName, GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean) returns true, but there is otherwise no action (the storyboard won't be restarted).

    A common control implementation pattern is to define a single private method of the control class that takes care of all possible VisualState changes for the control. Which visual state to use is determined by checking the control's properties. These properties might be public or private. Values of properties are adjusted by handlers in control logic for events such as OnGotFocus, and are checked just-in-time immediately before setting the visual state. The code example in this topic uses this implementation pattern. Alternatively, you can call GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean) for individual states from within event handlers, from control event handler overrides (the On* methods), or from helper methods that are called by all possible impetus for changing states (user-driven events, automation events, initialization logic).

    You might also call GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean) from within the PropertyChangedCallback implementation for a custom dependency property.

    Visual states and transitions

    In addition to the visual states, the visual state model also includes transitions. Transitions are animation actions controlled by a Storyboard that occur between each visual state when the state is changed. The transition can be defined differently for each combination of starting state and ending state as defined by your control's set of visual states. Transitions are defined by the Transitions property of VisualStateGroup and are usually defined in XAML. Most default control templates don't define transitions, and in this case the transitions between states happen instantaneously. For more info, see VisualTransition.

    A VisualTransition can also be defined such that it produces an implicit transition. Any dependency property that is specifically targeted for animation in either the From or@Windows.UI.Xaml.VisualTransition.To visual states of a VisualTransition and has different values across the state change can be animated with an implicit transition animation. This generated animation transitions between the From state value and the To state value of such a property using interpolation. The implicit transition animation lasts for the time stated by the GeneratedDuration value of a VisualTransition. Implicit transitions only apply to properties that are a Double, Color or Point value. In other words the property must be possible to implicitly animate using a DoubleAnimation, PointAnimation or ColorAnimation. For more info, see GeneratedDuration.

    Events for visual state changes

    CurrentStateChanging fires when the control begins to transition states as requested by the GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean) call. If a VisualTransition is applied to the state change, this event occurs when the transition begins.

    CurrentStateChanged fires after the control is in the state as requested by the GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean) call, just as the new Storyboard begins. No event is fired on the new storyboard's completion.

    If a VisualTransition is not applied, CurrentStateChanging and CurrentStateChanged fire in quick succession, but are guaranteed in that order if both occur.

    However, if a state change transition is interrupted by a new GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean) call, the CurrentStateChanged event is never raised for the first state transition. A new event series is fired for the next requested state change.

    OnApplyTemplate is not invoked for visual state changes. OnApplyTemplate is only invoked for the initial load of a control into a XAML UI.

    Attributing a custom control's named visual states

    If you are defining a custom control that has visual states in its control template XAML, it's a best practice to attribute the control class to indicate to control consumers which visual states are available. To do this, apply one or more TemplateVisualStateAttribute attributes at the class level of your control definition code. Each attribute should specify the state's x:Name attribute, which is the stateName value a control consumer would pass in a GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean) call to use that visual state. If the VisualState is part of a VisualStateGroup, that should also be indicated in the attribute definition.

    A related concept is that control authors should attribute the names of key control parts using TemplatePartAttribute. This is very helpful if control consumers want to access named parts from the template scope after the template is applied. TemplateVisualStateAttribute and TemplatePartAttribute combined help define the control contract for a control.

    Custom VisualStateManager

    As an advanced scenario, it is possible to derive from VisualStateManager and change the default GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean) behavior. The derived class should override the protected GoToStateCore method. Any instance of the custom VisualStateManager uses this Core logic when its GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean) method is called.

    Visual states for app view states

    Visual states aren't necessarily for custom controls. You can use visual states from new control templates that you apply to any Control instance where you're replacing the default template by setting the Template property. To set this up, you must define the control template and visual states that you're planning on using as a Style resource that's in either Page.Resources or Application.Resources. It's always best to start with a copy of the default template and modify only certain aspects of the template or even just modify some of the visual states and leave the basic composition alone. For more info, see Quickstart: Control templates.

    Visual states can be used to change properties of a Page or controls within the page to account for app window orientation. Your composition or your control's layout-related property values might change depending on whether the overall orientation is portrait or landscape. For more info about this scenario for GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean), see Quickstart: Designing apps for different window sizes.

    Visual states for elements that aren't controls

    Visual states are sometimes useful for scenarios where you want to change the state of some area of UI that's not immediately a Control subclass. You can't do this directly because the control parameter of the GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean) method requires a Control subclass, which refers to the object that the VisualStateManager acts upon. Page is a Control subclass, and it's fairly rare that you'd be showing UI in a context where you don't have a Page, or your Content root isn't a Control subclass. We recommend you define a custom UserControl to either be the Content root or be a container for other content you want to apply states to (such as a Panel ). Then you can call GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean) on your UserControl and apply states regardless of whether the rest of the content is a Control. For example you could apply visual states to UI that otherwise consists of just a SwapChainPanel so long as you placed that within your UserControl and declared named states that apply to the properties of the parent UserControl or of the named SwapChainPanel part of the template.

    Examples

    This example demonstrates control logic that uses the GoToState(Windows.UI.Xaml.Controls.Control,System.String,System.Boolean) method to transition between states.

    private void UpdateStates(bool useTransitions)
    {
        if (Value >= 0)
        {
            VisualStateManager.GoToState(this, "Positive", useTransitions);
        }
        else
        {
            VisualStateManager.GoToState(this, "Negative", useTransitions);
        }
    
        if (isFocused)
        {
            VisualStateManager.GoToState(this, "Focused", useTransitions);
        }
        else
        {
            VisualStateManager.GoToState(this, "Unfocused", useTransitions);
        }
    
    }
    
    Private Sub UpdateStates(ByVal useTransitions As Boolean)
        If Value >= 0 Then
            VisualStateManager.GoToState(Me, "Positive", useTransitions)
        Else
            VisualStateManager.GoToState(Me, "Negative", useTransitions)
        End If
    
        If isFocused Then
            VisualStateManager.GoToState(Me, "Focused", useTransitions)
        Else
            VisualStateManager.GoToState(Me, "Unfocused", useTransitions)
        End If
    
    End Sub
    
    <ResourceDictionary 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:local="using:NumericUpDownCustomControl"
        >
        <Style TargetType="local:NumericUpDown">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="local:NumericUpDown">
                        <Grid  Margin="3" 
                    Background="{TemplateBinding Background}">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="ValueStates">
                                    
                                    <!--Make the Value property red when it is negative.-->
                                    <VisualState x:Name="Negative">
                                        <Storyboard>
                                            <ColorAnimation To="Red"
                                        Storyboard.TargetName="TextBlock" 
                                        Storyboard.TargetProperty="(Foreground).(SolidColorBrush.Color)"/>
                                        </Storyboard>
                                    </VisualState>
                                    <!--Return the control to its initial state by
                        return the TextBlock Foreground to its 
                        original color.-->
                                    <VisualState x:Name="Positive" />
                                </VisualStateGroup>
    
                                <VisualStateGroup x:Name="FocusStates">
                                    <!--Add a focus rectangle to highlight the entire control
                        when it has focus.-->
                                    <VisualState x:Name="Focused">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisual" 
                                                       Storyboard.TargetProperty="Visibility" Duration="0">
                                                <DiscreteObjectKeyFrame KeyTime="0">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Visible</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <!--Return the control to its initial state by
                        hiding the focus rectangle.-->
                                    <VisualState x:Name="Unfocused"/>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
    
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                    <ColumnDefinition/>
                                </Grid.ColumnDefinitions>
    
                                <Border BorderThickness="1" BorderBrush="Gray" 
                        Margin="7,2,2,2" Grid.RowSpan="2" 
                        Background="#E0FFFFFF"
                        VerticalAlignment="Center" 
                        HorizontalAlignment="Stretch">
                                    <TextBlock x:Name="TextBlock" TextAlignment="Center" Padding="5"
                               Foreground="{TemplateBinding Foreground}"/>
    
                                </Border>
    
                                <RepeatButton Content="Up" Margin="2,5,5,0" 
                              x:Name="UpButton"
                              Grid.Column="1" Grid.Row="0"
                              Foreground="Green"/>
                                <RepeatButton Content="Down" Margin="2,0,5,5" 
                              x:Name="DownButton"
                              Grid.Column="1" Grid.Row="1" 
                              Foreground="Green"/>
    
                                <Rectangle Name="FocusVisual" Grid.ColumnSpan="2" Grid.RowSpan="2" 
                           Stroke="Red" StrokeThickness="1"  
                           Visibility="Collapsed"/>
                            </Grid>
    
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        
    </ResourceDictionary>
    
  • SetCustomVisualStateManager(Windows.UI.Xaml.FrameworkElement,Windows.UI.Xaml.VisualStateManager)
    SetCustomVisualStateManager(Windows.UI.Xaml.FrameworkElement,Windows.UI.Xaml.VisualStateManager)
    SetCustomVisualStateManager(Windows.UI.Xaml.FrameworkElement,Windows.UI.Xaml.VisualStateManager)
    SetCustomVisualStateManager(Windows.UI.Xaml.FrameworkElement,Windows.UI.Xaml.VisualStateManager)

    Sets the value of the CustomVisualStateManagerProperty attached property.

    public static void SetCustomVisualStateManager(Windows.UI.Xaml.FrameworkElement,Windows.UI.Xaml.VisualStateManager)public static void SetCustomVisualStateManager(Windows.UI.Xaml.FrameworkElement,Windows.UI.Xaml.VisualStateManager)Public Static Function SetCustomVisualStateManager(Windows.UI.Xaml.FrameworkElement,Windows.UI.Xaml.VisualStateManager) As void

    Parameters

    Remarks

    This API provides attached property support for XAML usages, and doesn't need to be changed in a custom VisualStateManager scenario.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.ComposableAttribute
Windows.Foundation.Metadata.WebHostHiddenAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.ThreadingAttribute

Details

Assembly

Windows.UI.Xaml.dll