次の方法で共有


IXRVisualStateCollection (Compact 2013)

3/28/2014

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

Syntax

class IXRVisualStateCollection : public IXRDependencyObject

Inheritance Hierarchy

IXRDependencyObject

    IXRVisualStateCollection

Methods

Method

Description

IXRVisualStateCollection::Add

Adds an item to the end of this collection and retrieves the index of where it was added.

IXRVisualStateCollection::Clear

Removes all items from this collection.

IXRVisualStateCollection::Contains

Determines whether an item is in this collection.

IXRVisualStateCollection::GetCount

Retrieves the number of items in this collection.

IXRVisualStateCollection::GetItem

Retrieves the item at the specified index in this collection.

IXRVisualStateCollection::IndexOf

Searches for the specified item and retrieves the zero-based index of its last occurrence within this collection.

IXRVisualStateCollection::Insert

Inserts an item into this collection at the location that has the specified index value.

IXRVisualStateCollection::Remove

Removes a specific item from this collection.

IXRVisualStateCollection::RemoveAt

Removes the item at the specified index from this collection.

Thread Safety

Members of this class are thread-safe if you previously called IXRApplication::CreateHostFromXaml and supplied it with an XRWindowCreateParams structure that has AllowsMultipleThreadAccess set to true.

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.

To create a new collection of visual states, do the following:

  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 IXRVisualStateCollection::Add method.
  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*, const WCHAR*, IXRDependencyObject*) on that element to set the IXRVisualStateGroupCollection as the value of the attached property VisualStateManager.VisualStateGroups.

When you create a class instance, use an IXRVisualStateCollectionPtr smart pointer instead of a raw interface pointer. For more information, see XRPtr<Interface>.

You can also define this collection in Microsoft Silverlight 3 XAML. For information about the differences between XAML in XAML for Windows Embedded and Silverlight 3, see Differences Between Microsoft Silverlight 3 and XAML for Windows Embedded. For more information about how to define this collection in the source XAML for your application, see the VisualStateGroup.States Property on MSDN.

Note

The contents of a ControlTemplate defined in Microsoft Silverlight 3 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 the XAML for Windows Embedded object tree.

.NET Framework Equivalent

None.

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

Classes for Collection Management
IXRControl::GoToVisualState
IXRVisualStateGroup::GetStates
IXRVisualStateGroup::SetStates