Gets or sets the custom VisualStateManager object that handles transitions between the states of a control.
<templateRoot VisualStateManager.CustomVisualStateManager="reference" />
<templateRoot> <VisualStateManager.CustomVisualStateManager> singleVisualStateManager </VisualStateManager.CustomVisualStateManager> </templateRoot>
XAML Values
- templateRoot
-
The root UIElement as defined within a control template.
- reference
-
An inline reference to an existing custom VisualStateManager instance. This might be a binding or a StaticResource markup extension usage to an object defined in a ResourceDictionary.
- singleVisualStateManager
-
Exactly one object element for a class that implements VisualStateManager. This is typically mapped to a custom xmlns namespace. For example:
<local:MyCustomStateMgr/>where "local" is a prefix that maps to the code namespace where the "MyCustomStateMgr" class is defined.
Remarks
This attached property is only needed for cases where you want to use a custom implementation class to handle your app's visual state changes, rather than the default VisualStateManager class implemented by the Windows Runtime. If you don't intend to use a custom implementation, you don't need to set this property.
If you want to implement your own logic for transitions between states, create a class that inherits from VisualStateManager, and override the GoToStateCore method. To use the custom class, set the VisualStateManager.CustomVisualStateManager attached property to an instance of your custom type. You also might want to override some of the event logic (RaiseCurrentStateChanged, RaiseCurrentStateChanging).
To reference your custom VisualStateManager class, set the value of the VisualStateManager.CustomVisualStateManager attached property within any control template where you want to use the custom VisualStateManager class behavior. You typically create an instance of the custom VisualStateManager class through default XAML construction in Application.Resources. Then the VisualStateManager.CustomVisualStateManager attached property is set using a StaticResource reference to the key of the custom VisualStateManager resource.
VisualStateManager.CustomVisualStateManager is an attached property, which supports a XAML usage. When getting this property in code, use GetCustomVisualStateManager. When setting this property in code, use SetCustomVisualStateManager instead. In code usages, the target parameter is the object where the attached property value is set. Another way to get or set the value in code is to use the dependency property system, calling either GetValue or SetValue and passing CustomVisualStateManagerProperty as the dependency property identifier.
Requirements
|
Minimum supported client | Windows 8 |
|---|---|
|
Minimum supported server | Windows Server 2012 |
|
Namespace |
Windows.UI.Xaml |
|
Metadata |
|
See also
Build date: 1/31/2013