Partager via


IXRItemsControl::SetItemsSource (Compact 7)

3/12/2014

This method sets a collection that is used to generate the content of the items control.

Syntax

virtual HRESULT STDMETHODCALLTYPE SetItemsSource(
    __in IXREnumerable* pItemsSource
) = 0;

Parameters

  • pItemsSource
    [in] Pointer to an IXREnumerable derived object, such as IXRValueCollection, that is used to generate the content of the items control. The default is null.

Return Value

Returns an HRESULT that indicates success or failure.

Remarks

You can add items to an IXRItemsControl by using either one of the following options:

  • Use the IXRItemsControl::GetItems method to get a collection of objects of different types. Then, populate the IXRItemCollection collection by manually adding items.
  • Use the IXRItemsControl::SetItemsSource method so that the control can populate the collection of items by getting items from a data collection.
    When you use the IXRItemsControl::SetItemsSource method, you must pass in an object that implements the IXRNotifyCollectionChanged interface so that changes in the collection will be reflected in the IXRItemsControl.

If the ItemsSource property is not null, the items in the Items property are read-only.

.NET Framework Equivalent

System.Windows.Controls.ItemsControl.ItemsSource

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

IXRItemsControl
Classes for UI Element Management
IXRListBox
IXRComboBox