Compartilhar via


IXRFrameworkElement::SetDataContext (Compact 2013)

3/28/2014

This method sets the data source object that provides the data context for an element that participates in data binding.

Syntax

virtual HRESULT STDMETHODCALLTYPE SetDataContext(
    __in XRValue* Value
) = 0;

Parameters

  • Value
    [in] Pointer to an XRValue object that represents the data-source object or data-source collection. The vType member of the XRValue object can be VTYPE_PROPERTYBAG or VTYPE_ENUMERABLE.

Return Value

Returns an HRESULT that indicates success or failure.

Remarks

For more information about the data-source object, see Remarks in IXRPropertyBag.

To use a specific interface pointer type, you can use the helper template version of this method that XAML for Windows Embedded provides. When you supply a derived type, this version automatically supplies a type-safe method that implicitly converts the returned type from a generic interface, so you do not have to explicitly call QueryInterface to convert the generic interface into the required object type.

To set the Value parameter to NULL, use the following syntax:

pFrameworkElement->SetDataContext((XRValue *)NULL);

.NET Framework Equivalent

System.Windows.FrameworkElement.DataContext

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

IXRFrameworkElement