Share via


IXRDependencyObject::SetDependencyProperty(DEPENDENCY_PROPERTY_ID, XRValue*) (Compact 2013)

3/28/2014

This method sets the value of the specified dependency property; use it if you want to refer to the property of a custom control by its identifier.

Syntax

virtual HRESULT STDMETHODCALLTYPE SetDependencyProperty(
    __in DEPENDENCY_PROPERTY_ID id,
    __in XRValue* pValue
) = 0;

Parameters

  • id
    [in] Value that represents the identifier of the dependency property of a custom control.
  • pValue
    [in] Pointer to an XRValue object that specifies the type and value to set for the dependency property.

Return Value

Returns an HRESULT that indicates success or failure.

Returns XR_E_INVALID_PROPERTY if this method was unable to locate the property requested.

Remarks

A dependency property is a property that depends on several other sources for its final calculated value. Several factors can influence the value of a dependency property, including the properties of related UI objects in the presentation layout.

Use this method to set the value of a dependency property that belongs to a custom object that you registered by using IXRApplication::RegisterXamlObject. You use RegisterXamlObject to associate a native Visual C++ object with a custom XAML element. To use this method, you need a DEPENDENCY_PROPERTY_ID to identify the dependency property. A DEPENDENCY_PROPERTY_ID value is returned when you call IXRApplication::RegisterDependencyProperty to register a dependency property after you have called IXRApplication::RegisterControl to register your custom control.

To set the value of a dependency property by referencing the property by name instead of its identifier, use the IXRDependencyObject::SetDependencyProperty(const WCHAR*, XRValue*) method.

To use any supported value type, such as a float value, you can use the helper template version of this method that XAML for Windows Embedded provides. When you supply a value type, this version automatically supplies a type-safe method that implicitly converts the returned type from a generic XRValue to the appropriate data type.

If you are working with an IXRCustomUserControl object, you can set a dependency property by using the IXRCustomUserControlBase::SetPropertyValue method.

.NET Framework Equivalent

System.Windows.DependencyObject.SetValue

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

IXRDependencyObject::SetDependencyProperty
IXRDependencyObject
IXRDependencyObject::SetAttachedProperty