dotnet / dotnet/dotnet-api-docs

How does the Viewbox Stretch Property work?

Open
#1,347 0 comments 0 reactions 0 assignees View on GitHub
area-WPF dotnet-api/prod Pri2 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

How does the Viewbox Stretch Property work?
Does the Viewbox Stretch Property apply a Render Transform or a Layout Transform?

The rendered size nor the desired size of the controls inside the viewbox seem to be effected by the sketch performed by the viewbox.

### Example 1
```xml




Hello, World


```
```
childGrid.RenderSize
{65.4433333333333,15.96}
Height: 15.96
IsEmpty: false
Width: 65.443333333333342
childGrid.DesiredSize
{65.4433333333333,15.96}
Height: 15.96
IsEmpty: false
Width: 65.443333333333342
```

Both report the height and width of the myTextBlock.

### Example 2
```xml




Hello, World


```
```
childGrid.RenderSize
{100,100}
Height: 100
IsEmpty: false
Width: 100
childGrid.DesiredSize
{100,100}
Height: 100
IsEmpty: false
Width: 100
```
Both report the height and width of the childGrid.

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 4a4c6761-d3e1-1d71-10f3-b344fa33e18b
* Version Independent ID: 1ade3f9b-7375-fed1-b3ae-d6c27cb3a5d6
* Content: [Viewbox.Stretch Property (System.Windows.Controls)](https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.viewbox.stretch?view=netframework-4.7.2#System_Windows_Controls_Viewbox_Stretch)
* Content Source: [xml/System.Windows.Controls/Viewbox.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Windows.Controls/Viewbox.xml)
* Product: **dotnet-api**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.