Compartir a través de


IXRFrameworkElement::GetWidth (Compact 2013)

3/28/2014

This method retrieves the width of this framework element.

Syntax

virtual HRESULT STDMETHODCALLTYPE GetWidth(
    __out float *pWidth
) = 0;

Parameters

  • pWidth
    [out] Pointer to a value that indicates the width of this framework element, in pixels.

Return Value

Returns an HRESULT that indicates success or failure.

Remarks

This method retrieves Width, which is a dependency property.

Several of the IXRFrameworkElement derived objects are also derived from IXRShape. Not all the IXRShape derived classes typically use Height or Width to specify their appearance, and instead use specific properties that might define a set of points. In this case, a Height or Width is calculated, but is not typically set directly.

Custom classes might have similar considerations, in which the class might have properties that are more meaningful for specifying dimensions than are Height or Width. In this case, Height or Width will both still be available as inherited members and are settable, even though it might be more desirable to not enable the Height or Width setting. In critical cases, it might be worth shadowing the Height and Width properties to prevent them from being set directly by consumers of the custom class.

IXRTextBlock is an example of a container object, where the container displays text within it. The size of the text can influence the size of the rendered IXRTextBlock object. Therefore, IXRTextBlock might not be honoring the specified Height or Width. For container objects such as IXRTextBlock, you should check two additional properties that expose the calculated size by calling IXRFrameworkElement::GetActualHeight and IXRFrameworkElement::GetActualWidth.

.NET Framework Equivalent

System.Windows.FrameworkElement.Width

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

IXRFrameworkElement
IXRFrameworkElement::SetWidth