--- title: "How to: Create Different Tile Patterns with a TileBrush" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "TileBrush [WPF], creating tile patterns" - "tile patterns [WPF], creating" - "creating [WPF], tile patterns with TileBrush" ms.assetid: 5aa46632-3527-4668-9d8d-0375c8af28aa --- # How to: Create Different Tile Patterns with a TileBrush This example shows how to use the property of a to create a pattern. The property enables you to specify how the content of a is repeated, that is, tiled to fill an output area. To create a pattern, you set the to , , , or . You must also set the of the so that it is smaller than the area that you are painting; otherwise, only a single tile is produced, regardless which setting you use. ## Example The following example creates five objects, gives them each a different setting, and uses them to paint five rectangles. Although this example uses the class to demonstrate behavior, the property works identically for all the objects, that is, for , , and . The following illustration shows the output that this example produces. ![TileBrush tiling example output](./media/graphicsmm-drawingbrushtilemodeexample.png "graphicsmm_DrawingBrushTileModeExample") Tile patterns created with the TileMode property [!code-csharp[BrushesIntroduction_snip#GraphicsMMDrawingBrushTileModeExample](~/samples/snippets/csharp/VS_Snippets_Wpf/BrushesIntroduction_snip/CSharp/TileModeExample.cs#graphicsmmdrawingbrushtilemodeexample)] [!code-vb[BrushesIntroduction_snip#GraphicsMMDrawingBrushTileModeExample](~/samples/snippets/visualbasic/VS_Snippets_Wpf/BrushesIntroduction_snip/visualbasic/tilemodeexample.vb#graphicsmmdrawingbrushtilemodeexample)] [!code-xaml[BrushesIntroduction_snip#GraphicsMMDrawingBrushTileModeExample](~/samples/snippets/xaml/VS_Snippets_Wpf/BrushesIntroduction_snip/XAML/TileModeExample.xaml#graphicsmmdrawingbrushtilemodeexample)] ## See also - [Set the Tile Size for a TileBrush](how-to-set-the-tile-size-for-a-tilebrush.md) - [Painting with Images, Drawings, and Visuals](painting-with-images-drawings-and-visuals.md)