_XRValueCollectionBaseT<IFace,ItemType,ItemComparer,ItemConverter,ItemLifeManager> (Compact 7)
3/12/2014
This C++ template base class represents a collection of data source objects of type XRValue that you can set as the data context for an IXRItemsControl.
Syntax
template<typename IFace, typename ItemType, typename ItemComparer, typename ItemConverter, typename ItemLifeManager>
class _XRValueCollectionBaseT : public IFace
Template Parameters
- IFace
A Silverlight for Windows Embedded interface that the collection class implements.
- ItemType
The class type of each item in the collection.
- ItemComparer
A class that provides methods to compare two given ItemType values. See _ItemComparer.
- ItemConverter
A class that provides methods to convert an ItemType to an XRValue and to convert an XRValue to an ItemType. See _ItemConverter.
- ItemLifeManager
A class that provides methods to create an XRValue instance or release a reference for an object of type ItemType. See _ItemLifeManager.
Members
The following tables list any methods and fields that belong to this class.
Methods
Methods | Description |
---|---|
Adds an XRValue object to the end of the collection. |
|
Removes all XRValue objects from the collection. |
|
Implements collection operations that clear items in the collection. |
|
Determines whether the specified XRValue object is in the collection. |
|
Obtains the number of XRValue objects in the collection. |
|
Obtains an IXREnumerator object that you use to enumerate the value of each item in the collection. |
|
Indicates whether you can add, remove, or modify XRValue objects in the collection. |
|
Obtains the XRValue object at the specified index. |
|
Determines the index of the specified XRValue object in the collection. |
|
Inserts an XRValue object into the collection at the specified index. |
|
Implements collection operations that add items to the collection. |
|
Removes the specified XRValue object from the collection. |
|
Removes the XRValue object at the specified index in the collection. |
|
Implements collection operations that remove items from the collection. |
|
Updates the data source object at the specified index within the collection by replacing it with a new XRValue object. |
|
Implements collection operations that update objects in the collection. |
Fields
Fields | Description |
---|---|
m_itemsList |
A vector<ItemType> object that organizes ItemType values in a linear sequence. |
m_nVersion |
The current version of the collection, used to verify that the enumerator and the collection are in sync. Several methods in this class that modify the collection also update the value of m_nVersion. |
Thread Safety
Members of this class are not thread safe when you add, remove, update, or clear the objects in the collection. When you are updating objects with new data from the data provider, implement single-threading and block other operations until the update is finished.
Remarks
This class is the base class for collections that enumerate data source objects. Call IXRFrameworkElement::SetDataContext to set this collection as the data source for an IXRItemsControl so that you can populate the IXRItemsControl with dynamic data stored in objects in this collection.
_XRValueCollectionBaseT implements an interface map so that you can access its methods through interfaces by using IUnknown::QueryInterface. _XRValueCollectionBaseT defines the interface map by using the BEGIN_QI_MAP and END_QI_MAP macros, and adds interface entries for IXRList, IXRValueCollection, and IXREnumerable by using the macro QI_MAP_INTERFACE(iface).
The following code example shows the interface mapping for _XRValueCollectionBaseT.
Important
For readability, the following code example does not contain security checking or error handling. Do not use the following code in a production environment.
template<typename IFace, typename ItemType, typename ItemComparer, typename ItemConverter, typename ItemLifeManager>
class _XRValueCollectionBaseT : public IFace
{
BEGIN_QI_MAP()
QI_MAP_INTERFACE(IXRList)
QI_MAP_INTERFACE(IXRValueCollection)
QI_MAP_INTERFACE(IXREnumerable)
END_QI_MAP()
Requirements
Header |
XRCollection.h |
See Also
Reference
Classes for Populating UI Elements with Data
XRObservableCollection<ItemType>
XRValueCollection<ItemType>