Compartilhar via


_XRValueCollectionBaseT<IFace,ItemType,ItemComparer,ItemConverter,ItemLifeManager> (Compact 2013)

3/28/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 XAML 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

_XRValueCollectionBaseT.Add(XRValue *)

Adds an XRValue object to the end of the collection.

_XRValueCollectionBaseT.Clear

Removes all XRValue objects from the collection.

_XRValueCollectionBaseT.ClearItemsImpl

Implements collection operations that clear items in the collection.

_XRValueCollectionBaseT.Contains(XRValue *,bool *)

Determines whether the specified XRValue object is in the collection.

_XRValueCollectionBaseT.GetCount(int *)

Obtains the number of XRValue objects in the collection.

_XRValueCollectionBaseT.GetEnumerator(IXREnumerator * *)

Obtains an IXREnumerator object that you use to enumerate the value of each item in the collection.

_XRValueCollectionBaseT.GetIsReadOnly(bool *)

Indicates whether you can add, remove, or modify XRValue objects in the collection.

_XRValueCollectionBaseT.GetItem(int,XRValue *)

Obtains the XRValue object at the specified index.

_XRValueCollectionBaseT.IndexOf(XRValue *,int *)

Determines the index of the specified XRValue object in the collection.

_XRValueCollectionBaseT.Insert(int,XRValue *)

Inserts an XRValue object into the collection at the specified index.

_XRValueCollectionBaseT.InsertItemImpl(int,XRValue *)

Implements collection operations that add items to the collection.

_XRValueCollectionBaseT.Remove(XRValue *)

Removes the specified XRValue object from the collection.

_XRValueCollectionBaseT.RemoveAt(int)

Removes the XRValue object at the specified index in the collection.

_XRValueCollectionBaseT.RemoveItemImpl(int)

Implements collection operations that remove items from the collection.

_XRValueCollectionBaseT.SetItem(int,XRValue *)

Updates the data source object at the specified index within the collection by replacing it with a new XRValue object.

_XRValueCollectionBaseT.SetItemImpl(int,XRValue *)

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>