FixedPage.SetLeft Method

Sets the distance between the left side of an element and the left side of its parent Canvas.

Namespace:  System.Windows.Documents
Assembly:  PresentationFramework (in PresentationFramework.dll)

public static void SetLeft(
	UIElement element,
	double length
)

Parameters

element
Type: System.Windows.UIElement

The element on which to set the left offset.

length
Type: System.Double

The new distance between the left side of the element and the left side of its parent canvas.

The child element's left offset does not affect the size of the parent canvas.

If both a left and right offset have been specified on the same element, the left offset takes precedence.

When setting the left offset as a percentage, the percentage value is based on the width of the parent canvas.

The following example shows use of the SetLeft method.

// --------------------- CreateFifthPageContent ----------------------- 
/// <summary> 
///   Creates the content for the fifth fixed page.</summary> 
/// <returns> 
///   The page content for the fifth fixed page.</returns> 
private PageContent CreateFifthPageContent()
{
    PageContent pageContent = new PageContent();
    FixedPage   fixedPage   = new FixedPage();
    UIElement   visual      = CreateThirdVisual(false);

    FixedPage.SetLeft(visual, 0);
    FixedPage.SetTop(visual, 0);

    double pageWidth = 96 * 8.5;
    double pageHeight = 96 * 11;

    fixedPage.Width = pageWidth;
    fixedPage.Height = pageHeight;

    fixedPage.Children.Add((UIElement)visual);

    Size sz = new Size(8.5 * 96, 11 * 96);
    fixedPage.Measure(sz);
    fixedPage.Arrange(new Rect(new Point(), sz));
    fixedPage.UpdateLayout();

    ((IAddChild)pageContent).AddChild(fixedPage);
    return pageContent;
}// end:CreateFifthPageContent()

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft