BaselineAlignment Enumeration
Collapse the table of content
Expand the table of content

BaselineAlignment Enumeration

Describes how the baseline for a text-based element is positioned on the vertical axis, relative to the established baseline for text.

Namespace:  System.Windows
Assembly:  PresentationCore (in PresentationCore.dll)

public enum BaselineAlignment
<object property="enumerationMemberName" .../>

Member nameDescription
TopA baseline that is aligned to the upper edge of the containing box.
CenterA baseline that is aligned to the center of the containing box.
BottomA baseline that is aligned at the lower edge of the containing box.
BaselineA baseline that is aligned at the actual baseline of the containing box.
TextTopA baseline that is aligned at the upper edge of the text baseline.
TextBottomA baseline that is aligned at the lower edge of the text baseline.
SubscriptA baseline that is aligned at the subscript position of the containing box.
SuperscriptA baseline that is aligned at the superscript position of the containing box.

The following example shows how to use the BaselineAlignment property to align text within a containing box (in this case, a Paragraph).

<Page xmlns=""
    <FlowDocument ColumnWidth="800">
      <Paragraph Background="Blue">

        <!-- The large text forces a large containing box size for the paragraph.
             The smaller text fragments align themselves vertically within this  
             box according to their BaselineAlignment values. -->
        <Span FontSize="40">Baseline:</Span>
        <Span BaselineAlignment="Baseline">Baseline</Span>
        <Span BaselineAlignment="Top">Top</Span>
        <Span BaselineAlignment="Bottom">Bottom</Span>
        <Span BaselineAlignment="Center">Center</Span>
      <Paragraph Background="Green">

        <!-- The BaselineAlignment values of Subscript and Superscript below
             force the containing box to be larger then it normally would be. -->
        <Span FontSize="40">Baseline:</Span>
        <Span BaselineAlignment="Subscript">Subscript</Span>
        <Span BaselineAlignment="Baseline">Baseline</Span>
        <Span BaselineAlignment="Superscript">Superscript</Span>
      <Paragraph Background="Yellow" LineHeight="60" LineStackingStrategy="BlockLineHeight">

        <!-- A deliberate BlockLineHeight stacking strategy change, to show the difference between Top/TextTop 
        and Bottom/TextBottom-->
        <Span FontSize="40" BaselineAlignment="Baseline">Baseline:</Span>
        <Span BaselineAlignment="Top">Top</Span>
        <Span BaselineAlignment="TextTop">TextTop</Span>
        <Span BaselineAlignment="Bottom">Bottom</Span>
        <Span BaselineAlignment="TextBottom">TextBottom</Span>

The following illustration shows the result of the code above.

Baseline Alignment

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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

Community Additions

© 2016 Microsoft