Compartilhar via


IXRDependencyObject::GetAttachedProperty(const WCHAR*, const WCHAR*, BSTR*) (Compact 2013)

3/28/2014

This method retrieves the value of the specified attached property.

Use this method when the specified attached property has a string type.

Syntax

virtual HRESULT STDMETHODCALLTYPE GetAttachedProperty(
    __in const WCHAR* pName,
    __in_opt const WCHAR* pNamespace,
    __out BSTR* pBSTR
) = 0;

Parameters

  • pName
    [in] Pointer to a string that contains the name of the attached property that you want to retrieve.
  • pNamespace
    [in, optional] Pointer to a string that contains the name of the namespace in which to look. Use this parameter to access an attached property of a custom control. If pNamespace is null, this method looks in the current default namespace.
  • pBSTR
    [out] On return, contains a pointer to a string that reflects the value of the property that you specified in pName.

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

Attached properties are a concept that is part of the XAML language. You can set an attached property on objects or XAML elements, even if that property is not conventionally defined in the properties list that belongs to the setting object. For attached properties such as Canvas.Top, the object.property notation does not work because the two "dots" in the syntax create ambiguity. Instead, you set attached properties in XAML for Windows Embedded by using a (C++) string that defines the full dotted name of the attached property (for example, L"Canvas.Top"). In the pName parameter, the "." (dot) is considered part of the property name/identifier.

You can use this method to retrieve the value of attached properties in XAML for Windows Embedded, such as Canvas.Left. In this case, the attached property name consists of the owner class name for the attached property, a dot, and the attached property name ("ownerType.propertyName").

You can call this method to retrieve the value of an attached property in XAML for Windows Embedded, or to retrieve the value of a custom attached property that you create and register for a user-defined control.

.NET Framework Equivalent

System.Windows.DependencyObject.GetValue

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

IXRDependencyObject::GetAttachedProperty
IXRDependencyObject