TileBrush::AlignmentY Property
Gets or sets the vertical alignment of content in the TileBrush base tile.
Assembly: PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
public: property AlignmentY AlignmentY { AlignmentY get (); void set (AlignmentY value); }
<object AlignmentY="AlignmentY" .../>
Property Value
Type: System.Windows.Media::AlignmentYA value that specifies the vertical position of TileBrush content in its base tile. The default value is Center.
The AlignmentX and AlignmentY properties of a TileBrush are used when either of the following conditions are true:
The Stretch property is Uniform or UniformToFill and the Viewbox and Viewport have different aspect ratios.
The Stretch property is None and the Viewbox and Viewport are different sizes.
Note that you specify the dimensions of TileBrush content by using the Viewbox property; you specify the position and size of the TileBrush base tile by using the Viewport property.
This example shows how to control the horizontal and vertical alignment of content in a tile. To control the horizontal and vertical alignment of a TileBrush, use its AlignmentX and AlignmentY properties.
The AlignmentX and AlignmentY properties of a TileBrush are used when either of the following conditions is true:
The Stretch property is Uniform or UniformToFill and the Viewbox and Viewport have different aspect ratios.
The Stretch property is None and the Viewbox and Viewport are different sizes.
The following example aligns the content of a DrawingBrush, which is a type of TileBrush, to the upper-left corner of its tile. To align the content, the example sets the AlignmentX property of the DrawingBrush to Left and the AlignmentY property to Top. This example produces the following output.

<Rectangle Width="150" Height="150" Stroke="Red" StrokeThickness="2" Margin="20"> <Rectangle.Fill> <!-- This brush's content is aligned to the top-left of its tile. --> <DrawingBrush Stretch="None" AlignmentX="Left" AlignmentY="Top"> <DrawingBrush.Drawing> <GeometryDrawing Brush="MediumBlue"> <GeometryDrawing.Geometry> <GeometryGroup> <EllipseGeometry RadiusX="20" RadiusY="45" Center="50,50" /> <EllipseGeometry RadiusX="45" RadiusY="20" Center="50,50" /> </GeometryGroup> </GeometryDrawing.Geometry> <GeometryDrawing.Pen> <Pen Brush="Gray" Thickness="10" /> </GeometryDrawing.Pen> </GeometryDrawing> </DrawingBrush.Drawing> </DrawingBrush> </Rectangle.Fill> </Rectangle>
The next example aligns the content of a DrawingBrush to the lower-right corner of its tile by setting the AlignmentX property to Right and the AlignmentY property to Bottom. The example produces the following output.

<Rectangle Width="150" Height="150" Stroke="Red" StrokeThickness="2" Margin="20"> <Rectangle.Fill> <!-- This brush's content is aligned to the bottom right of its tile. --> <DrawingBrush Stretch="None" AlignmentX="Right" AlignmentY="Bottom"> <DrawingBrush.Drawing> <GeometryDrawing Brush="MediumBlue"> <GeometryDrawing.Geometry> <GeometryGroup> <EllipseGeometry RadiusX="20" RadiusY="45" Center="50,50" /> <EllipseGeometry RadiusX="45" RadiusY="20" Center="50,50" /> </GeometryGroup> </GeometryDrawing.Geometry> <GeometryDrawing.Pen> <Pen Brush="Gray" Thickness="10" /> </GeometryDrawing.Pen> </GeometryDrawing> </DrawingBrush.Drawing> </DrawingBrush> </Rectangle.Fill> </Rectangle>
The next example aligns the content of a DrawingBrush to the upper-left corner of its tile by setting the AlignmentX property to Left and the AlignmentY property to Top. It also sets the Viewport and TileMode of the DrawingBrush to produce a tile pattern. The example produces the following output.

The illustration highlights a base tile so that you can see how its content is aligned. Notice that the AlignmentX setting has no effect because the content of the DrawingBrush completely fills the base tile horizontally.
<Rectangle Width="150" Height="150" Stroke="Black" StrokeThickness="2" Margin="20"> <Rectangle.Fill> <!-- This brush's content is aligned to the top left of its tile. --> <DrawingBrush Stretch="Uniform" Viewport="0,0,0.25,0.5" TileMode="Tile" AlignmentX="Left" AlignmentY="Top"> <DrawingBrush.Drawing> <GeometryDrawing Brush="MediumBlue"> <GeometryDrawing.Geometry> <GeometryGroup> <EllipseGeometry RadiusX="20" RadiusY="45" Center="50,50" /> <EllipseGeometry RadiusX="45" RadiusY="20" Center="50,50" /> </GeometryGroup> </GeometryDrawing.Geometry> <GeometryDrawing.Pen> <Pen Brush="Gray" Thickness="10" /> </GeometryDrawing.Pen> </GeometryDrawing> </DrawingBrush.Drawing> </DrawingBrush> </Rectangle.Fill> </Rectangle>
The final example aligns the content of a tiled DrawingBrush to the lower-right of its base tile by setting the AlignmentX property to Right and the AlignmentY property to Bottom. The example produces the following output.

Again, the AlignmentX setting has no effect because the content of the DrawingBrush completely fills the base tile horizontally.
<Rectangle Width="150" Height="150" Stroke="Red" StrokeThickness="2" Margin="20"> <Rectangle.Fill> <!-- This brush's content is aligned to the bottom right of its tile. --> <DrawingBrush Stretch="None" AlignmentX="Right" AlignmentY="Bottom"> <DrawingBrush.Drawing> <GeometryDrawing Brush="MediumBlue"> <GeometryDrawing.Geometry> <GeometryGroup> <EllipseGeometry RadiusX="20" RadiusY="45" Center="50,50" /> <EllipseGeometry RadiusX="45" RadiusY="20" Center="50,50" /> </GeometryGroup> </GeometryDrawing.Geometry> <GeometryDrawing.Pen> <Pen Brush="Gray" Thickness="10" /> </GeometryDrawing.Pen> </GeometryDrawing> </DrawingBrush.Drawing> </DrawingBrush> </Rectangle.Fill> </Rectangle>
The examples use DrawingBrush objects to demonstrate how the AlignmentX and AlignmentY properties are used. These properties behave identically for all the tile brushes: DrawingBrush, ImageBrush, and VisualBrush. For more information about tile brushes, see Painting with Images, Drawings, and Visuals.
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.