Files
docs-desktop/dotnet-desktop-guide/framework/wpf/advanced/how-to-use-automatic-layout-to-create-a-button.md
Andy (Steve) De George be103da07e Replace various WPF include files with content (#1335)
* net-current-v30plus-md.md

* net-current-v40plus-md.md

* tla2sharptla-ui-md.md

* tla2sharptla-uiautomation-md.md

* tla2sharptla-winclient-md.md

* tla2sharptla-xaml-md.md

* tlasharptla-ui-md.md

* tlasharptla-uiautomation-md.md

* tlasharptla-winclient-md.md

* tlasharptla-xaml-md.md

* fix warnings
2022-03-16 12:14:11 -04:00

1.6 KiB

title, ms.date, helpviewer_keywords, ms.assetid
title ms.date helpviewer_keywords ms.assetid
How to: Use Automatic Layout to Create a Button 03/30/2017
Button controls [WPF], creating with automatic layout
automatic layout [WPF], creating buttons
96c206d0-9e77-4784-9d2d-5045aed2021c

How to: Use Automatic Layout to Create a Button

This example describes how to use the automatic layout approach to create a button in a localizable application.

Localization of a UI was adapted for required adjustment. Now with the capabilities of Windows Presentation Foundation (WPF) you can design elements that reduce the need for adjustment. The approach to writing applications that can be more easily resized and repositioned is called automatic layout.

Example

The following two Extensible Application Markup Language (XAML) examples create applications that instantiate a button; one with English text and one with Spanish text. Notice that the code is the same except for the text; the button adjusts to fit the text.

[!code-xamlLocalizationBtn_snip#1]

[!code-xamlLocalizationBtn#1]

The following graphic shows the output of the code samples with auto-resizable buttons:

The same button with text in different languages

See also