FixedPage.SetTop Method (UIElement, Double)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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

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

public static void SetTop(
	UIElement element,
	double length


Type: System.Windows.UIElement

The element on which to set the top offset.

Type: System.Double

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

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

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

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

The following example shows use of the SetTop 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;


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

    return pageContent;
}// end:CreateFifthPageContent()

.NET Framework
Available since 3.0
Return to top