Skip to content

Latest commit

 

History

History
45 lines (30 loc) · 1.82 KB

File metadata and controls

45 lines (30 loc) · 1.82 KB
-api-id -api-type
T:Microsoft.UI.Xaml.Controls.Viewbox
winrt class

Microsoft.UI.Xaml.Controls.Viewbox

-description

Defines a content decorator that can stretch and scale a single child to fill the available space.

-xaml-syntax

<ViewBox .../>
-or-
<ViewBox ...>
  child
</ViewBox>

-remarks

Viewbox is a container control that scales its content to a specified size.

Viewbox control

-examples

[!div class="nextstepaction"] Open the WinUI 3 Gallery app and see the ViewBox in action

The WinUI 3 Gallery app includes interactive examples of most WinUI 3 controls, features, and functionality. Get the app from the Microsoft Store or get the source code on GitHub.

The following example shows what happens when you change the StretchDirection and Stretch properties of a Viewbox. The example includes three Viewbox controls that have different sizes. The same image is displayed in the Viewbox controls so that you can compare the differences. You can manipulate the stretching and scaling of the image by clicking the buttons that correspond to the values for the Stretch and StretchDirection enumerations.

[!code-xamlViewBoxXAML]

[!code-csharpViewBoxCode]

-see-also

FrameworkElement