IXRVisualStateCollection (Windows Embedded CE 6.0)

1/6/2010

This class represents a collection of IXRVisualState objects that define state-dependent visual appearances for an IXRUserControl object.

Syntax

class IXRVisualStateCollection : public IXRCollection<IXRDependencyObject*, IXRDependencyObject*>

Methods

IXRVisualStateCollection inherits the methods from the template class IXRCollection<In_T, Out_T>. It uses In_T parameters of type IXRDependencyObject*, and uses Out_T parameters of type IXRDependencyObject*.

Remarks

This collection contains information about the visual states for a control. Each visual state defines a storyboard animation for entering a specific state of a control, such as MouseOver, Pressed, or Normal.

Do the following to create a new collection of visual states:

  1. Use the IXRApplication::CreateObject(IID,Object) method to create an empty IXRVisualStateCollection object.
  2. Use CreateObject to create multiple IXRVisualState objects that define the visual appearance for a state of a control.
  3. Add each IXRVisualState object to the IXRVisualStateCollection collection by calling the inherited method IXRCollection<In_T, Out_T>::Add.
  4. Set the new collection for an IXRVisualStateGroup by calling IXRVisualStateGroup::SetStates.

This IXRVisualStateGroup object must belong to an IXRVisualStateGroupCollection. You can create a new IXRVisualStateGroupCollection collection and add the new IXRVisualStateGroup to it.

To set a new collection of IXRVisualState objects for an IXRUserControl object at run-time, retrieve the element that is the content of an IXRUserControl. This element can be obtained by calling IXRUserControl::GetContent. Then, call IXRDependencyObject::SetAttachedProperty(const WCHAR*, IXRDependencyObject*) on that element to set the IXRVisualStateGroupCollection as the value of the attached property VisualStateManager.VisualStateGroups.

You can also define this collection in Microsoft Silverlight 2 XAML. For information about the differences between XAML in Silverlight for Windows Embedded and Silverlight 2, see Differences Between Silverlight for the Web and Silverlight for Windows Embedded. For more information about how to define this collection in the source XAML for your application, see this Microsoft Web site.

Note

The contents of a ControlTemplate defined in Microsoft Silverlight 2 XAML cannot be accessed from C++. Therefore, a visual-state collection that was defined in a ControlTemplate in the source XAML for your application cannot be accessed in Silverlight object tree.

Inheritance Hierarchy

IXRDependencyObject

    IXRCollection<In_T, Out_T>

        IXRVisualStateCollection

.NET Framework Equivalent

None.

Requirements

Header XamlRuntime.h
sysgen SYSGEN_XAML_RUNTIME
Windows Embedded CE Windows Embedded CE 6.0 R3

See Also

Reference

Classes for Collection Management
IXRControl::GoToVisualState