Share via


IXRDependencyObject::SetDependencyProperty(const WCHAR*, 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 by its name.

Syntax

virtual HRESULT STDMETHODCALLTYPE SetDependencyProperty(
    __in const WCHAR* pName,
    __in XRValue* pValue
) = 0;

Parameters

  • pName
    [in] Pointer to a string that specifies the name of the dependency property.
  • 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. This method obtains the dependency property by referencing the name of the property.

To reference the dependency property of a custom control by its identifier instead of by its name, use the IXRDependencyObject::SetDependencyProperty(DEPENDENCY_PROPERTY_ID, XRValue*) method. 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 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