dotnet / dotnet/wpf

Control's size is incorrect when in a grid column with Width="auto" and MaxWidth="100"

Open
#9,485 6 comments 0 reactions 1 assignee Claimed by @anjaligupta-dev View on GitHub
Investigate
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### Description

Control's size is incorrect when in a grid column with Width="auto" and MaxWidth="100"

### Reproduction Steps

1. Create new project targeting net8.0-windows
2. Add the following code to `MainWindow.xaml`
```








```
3. Run the project.

### Expected behavior

The TextBlock's width should be 100 and the text should be wrapped. If I drag the GridSplitter, The width of TextBlock becomes correct.
![image](https://github.com/user-attachments/assets/f11a0b23-0e34-4f65-86eb-753b07e8cd31)

### Actual behavior

The TextBlock's width is its desired width and the text is not wrapped.
![image](https://github.com/user-attachments/assets/447a638d-d924-4c3e-997f-3c3876cccf6b)

### Regression?

_No response_

### Known Workarounds

_No response_

### Impact

_No response_

### Configuration

_No response_

### Other information

_No response_

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.