IXRFrameworkElement::SetMargin (Windows Embedded CE 6.0)

1/6/2010

This method sets the width of the frame that surrounds this framework element.

Syntax

virtual HRESULT STDMETHODCALLTYPE SetMargin(
    XRThickness *pMargin
) = 0; 

Parameters

  • pMargin
    [in] Pointer to an XRThickness structure that describes the new width of the frame that surrounds this framework element.

Return Value

Returns an HRESULT that indicates success or failure.

Remarks

The pMargin value is the space between this element and other elements that will be adjacent to it when the layout system renders the UI. Shared elements might be peer elements in the collection, or might also be a parent of this element.

If a margin value is greater than 0, Silverlight applies space outside the element layout's ActualWidth and ActualHeight dependency properties. These properties are retrieved by using IXRFrameworkElement::GetActualWidth and IXRFrameworkElement::GetActualHeight.

Margin values are additive for peer elements in a layout. For example, two horizontally-adjacent or vertically-adjacent elements, both with a margin of 30 pixels set on the adjoining edge, would have 60 total pixels of space between them.

For elements that set margins, if the allocated rectangle space is not large enough for the size of the frame plus the element content area, the element will not typically reduce the size of the specified frame to fit the space. Instead, the element will reduce the size of its content area, at the time when layout is calculated.

Negative values for margin dimensions are permitted, but should be used with caution. Negative margins will typically clip the content of the object in the specified side of the bounding rectangle.

.NET Framework Equivalent

System.Windows.FrameworkElement.Margin

Requirements

Header XamlRuntime.h
sysgen SYSGEN_XAML_RUNTIME
Windows Embedded CE Windows Embedded CE 6.0 R3

See Also

Reference

IXRFrameworkElement
IXRFrameworkElement::GetMargin