-
-
Notifications
You must be signed in to change notification settings - Fork 46
Description
Describe the bug
When using a TextBox with AcceptsReturn="True" and an explicit Height set, the editable text area only displays approximately 36px (the MinHeight) instead of filling the full height of the TextBox. This makes the TextBox appear collapsed even though its outer dimensions are correct.
The root cause is that the TextBox template uses StackPanel to wrap the content. StackPanel does not stretch its children to fill available space - it only gives them their desired size. This means the inner Border containing the text area gets its MinHeight (36px) instead of stretching to fill the explicit Height.
To Reproduce
- Create a TextBox with explicit dimensions and multiline support:
<TextBox
Width="200"
Height="150"
AcceptsReturn="True"
TextWrapping="Wrap" />- Run the application
- Observe that the editable text area is only ~36px tall instead of 150px
- The outer TextBox bounds are correct (200x150), but the inner content area is collapsed
Expected behavior
The TextBox content area should stretch to fill the entire specified Height, allowing users to see and edit multiple lines of text within the full 150px height.
Screenshots
The issue is visible when inspecting the visual tree: the outer TextBox has correct bounds but the inner Border only has MinHeight.
Desktop (please complete the following information):
- OS: Windows 11
- Avalonia Version: 11.3.0+
- ShadUI Version: Latest (tested against main branch)
Additional context
The fix is to replace StackPanel with Grid using appropriate RowDefinitions so that the content can stretch:
- Outer
StackPanel→GridwithRowDefinitions="Auto,*" - Inner
StackPanel(inside DataValidationErrors) →GridwithRowDefinitions="*,Auto" - Add
VerticalAlignment="Stretch"to the Border - Remove the hard-coded
Height="{TemplateBinding shadui:ControlAssist.Height}"binding (let it stretch naturally)
This allows the Border to stretch and fill the available space when an explicit Height is set on the TextBox.
PR with fix: #67