Files
docs-desktop/dotnet-desktop-guide/framework/wpf/advanced/how-to-use-a-grid-for-automatic-layout.md
T
Andy De George da363692ff Initial WPF content migrated (#17)
* Reset branch for WPF changes

* Convert BMP to PNG; fix link-out-of-scope err

* Add snippets for WPF... 6794 files!!!!

* Add missing snippets

* update file updated between migration

* Fix paths to include

* update breadcrumb and toc

* fix index links

* fix index links

* fix index links

* fix markdown
2020-09-04 09:46:28 -07:00

1.9 KiB

title, ms.date, helpviewer_keywords, ms.assetid
title ms.date helpviewer_keywords ms.assetid
How to: Use a Grid for Automatic Layout 03/30/2017
grids [WPF], automatic layout
automatic layout [WPF], grid use
ab9de407-e0c1-4047-bdf0-24951bf73879

How to: Use a Grid for Automatic Layout

This example describes how to use a grid in the automatic layout approach to creating a localizable application.

Localization of a [!INCLUDETLA#tla_ui] can be a time consuming process. Often localizers need to re-size and reposition elements in addition to translating text. In the past each language that a [!INCLUDETLA2#tla_ui] was adapted for required adjustment. Now with the capabilities of [!INCLUDETLA#tla_winclient] you can design elements that reduce the need for adjustment. The approach to writing applications that can be more easily re-sized and repositioned is called auto layout.

The following [!INCLUDETLA#tla_xaml] example demonstrates using a grid to position some buttons and text. Notice that the height and width of the cells are set to Auto; therefore the cell that contains the button with an image adjusts to fit the image. Because the xref:System.Windows.Controls.Grid element can adjust to its content it can be useful when taking the automatic layout approach to designing applications that can be localized.

Example

The following example shows how to use a grid.

[!code-xamlLocalizationGrid#1]

The following graphic shows the output of the code sample.

Grid example
Grid

See also