Partager via


IXRDependencyObject::GetDependencyProperty(const WCHAR*, XRValue*) (Compact 2013)

3/28/2014

This method retrieves the value of the specified dependency property; use it if you want to refer to the property by its name.

Syntax

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

Parameters

  • pName
    [in] Pointer to a string that represents the name of the dependency property.
  • pValue
    [out] Pointer to an XRValue object that represents the type and value of 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 obtain the value of a dependency property that belongs to a custom object that you registered by using IXRApplication::RegisterXamlObject. RegisterXamlObject is used to associate a native Visual C++ object with a custom XAML element. This method obtains the dependency property by referencing the property name.

To reference the dependency property of a custom control by its identifier instead of by its name, use the IXRDependencyObject::GetDependencyProperty(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 obtain a dependency property by using the IXRCustomUserControlBase::GetPropertyValue method.

.NET Framework Equivalent

System.Windows.DependencyObject.GetValue

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

IXRDependencyObject::GetDependencyProperty
IXRDependencyObject
IXRDependencyObject::GetAttachedProperty