IXRItemCollection (Compact 2013)

3/28/2014

This class holds the list of items that together form the content of an IXRItemsControl.

Syntax

class IXRItemCollection : public IXRDependencyObject

Inheritance Hierarchy

IXRDependencyObject

    IXRItemCollection

Methods

Method

Description

IXRItemCollection::Add

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

IXRItemCollection::Clear

Removes all items from this collection.

IXRItemCollection::Contains

Determines whether an item is in this collection.

IXRItemCollection::GetCount

Retrieves the number of items in this collection.

IXRItemCollection::GetItem

Retrieves the item at the specified index in this collection.

IXRItemCollection::IndexOf

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

IXRItemCollection::Insert

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

IXRItemCollection::Remove

Removes the last occurrence of a specific item from this collection.

IXRItemCollection::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

IXRItemCollection provides the collection support for IXRItemsControl::GetItems.

To obtain a pointer to this collection, call IXRItemsControl::GetItems. Then, use the methods of this class to add, remove, or retrieve items. You can also clear the complete collection by calling the IXRItemCollection::Clear method.

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

You can support multiple kinds of objects derived from IXRDependencyObject in an IXRItemCollection. For example, if you call the GetItems method from either of the IXRItemsControl-inherited classes IXRListBox or IXRComboBox, the object type that this collection stores can be either an IXRListBoxItem object or an IXRComboBoxItem object. The object type can also be any IXRDependencyObject-derived object that you want to put in a list for the user to scroll and select, including objects derived from IXRShape, IXRTextBlock, or IXRBitmapImage.

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

You can define an item 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 ItemsControl Class on MSDN.

The XAML implicit collection syntax shows how to populate items in the source XAML for the IXRItemCollection returned by IXRItemsControl::GetItems.

Note

ItemsControl.Items is not supported for use as an attached property.

.NET Framework Equivalent

System.Windows.Controls.ItemCollection

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

Classes for Collection Management
IXRItemsControl::GetItems