You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the issue is that when there's a size constraint, MaxWidth in my example, the desired size is constrained before inflating the result with the margin in Layoutable.MeasureCore. So the desired size ends up being 100 - 20 = 80 instead of 100.
If there's a StackPanel that lets its children be as wide as they desire this also results in the text block drawing outside of its containing control.
To Reproduce
Create a new desktop app and paste the following into the Window in MainWindow.xaml.
<Canvas>
<Border Canvas.Top="100" Canvas.Left="100"MaxWidth="100"Background="#8800ff00">
<BorderBackground="#88ff0000"Margin="-10">
<StackPanelOrientation="Vertical">
<TextBlockText="Lorem ipsum dolor sit amet"Margin="10"TextTrimming="CharacterEllipsis"/>
</StackPanel>
</Border>
</Border>
<Border Canvas.Top="150" Canvas.Left="100"MaxWidth="100"Background="#8800ff00">
<BorderBackground="#88ff0000"Margin="-10">
<TextBlockText="Lorem ipsum dolor sit amet"Margin="10"TextTrimming="CharacterEllipsis"/>
</Border>
</Border>
<Border Canvas.Top="200" Canvas.Left="100"MaxWidth="100"Background="#8800ff00">
<BorderBackground="#88ff0000">
<StackPanelOrientation="Vertical">
<TextBlockText="Lorem ipsum dolor sit amet"TextTrimming="CharacterEllipsis"/>
</StackPanel>
</Border>
</Border>
</Canvas>
This results in the following:
Expected behavior
The expected behavior is for all of the outer Border elements to have the same width, ~100, and for all the text blocks with orange background to have the same width, ~100, and that the text should not be drawn outside of the orange rectangle.
The bottom most one is the one with the correct width.
Avalonia version
11.2.3
OS
Windows
Additional context
No response
The text was updated successfully, but these errors were encountered:
Describe the bug
I think the issue is that when there's a size constraint, MaxWidth in my example, the desired size is constrained before inflating the result with the margin in Layoutable.MeasureCore. So the desired size ends up being 100 - 20 = 80 instead of 100.
If there's a StackPanel that lets its children be as wide as they desire this also results in the text block drawing outside of its containing control.
To Reproduce
Create a new desktop app and paste the following into the Window in MainWindow.xaml.
This results in the following:
![Image](https://private-user-images.githubusercontent.com/973314/410007700-a727b833-8fd1-4f6f-a99c-bd3ae5519c30.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNjcxMTcsIm5iZiI6MTczOTI2NjgxNywicGF0aCI6Ii85NzMzMTQvNDEwMDA3NzAwLWE3MjdiODMzLThmZDEtNGY2Zi1hOTljLWJkM2FlNTUxOWMzMC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMVQwOTQwMTdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05MGU1N2U3ZDhhMGQ0YWE3OWRiNGU5NWY3ZDM0N2U5MTgwOTk3ZGQwNDQxM2ViMzE0MmY2MGIwYzZjNDEyOWI2JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.mJ3jWjjCZD0wfIrSQ4S9lupDpctW0VH7jVm_GbcY4lI)
Expected behavior
The expected behavior is for all of the outer Border elements to have the same width, ~100, and for all the text blocks with orange background to have the same width, ~100, and that the text should not be drawn outside of the orange rectangle.
The bottom most one is the one with the correct width.
Avalonia version
11.2.3
OS
Windows
Additional context
No response
The text was updated successfully, but these errors were encountered: