Skip to content

Comments

fix: TextBox template uses Grid instead of StackPanel for proper height stretching#67

Open
iwatakeshi wants to merge 1 commit intoaccntech:mainfrom
iwatakeshi:fix/textbox-multiline-height
Open

fix: TextBox template uses Grid instead of StackPanel for proper height stretching#67
iwatakeshi wants to merge 1 commit intoaccntech:mainfrom
iwatakeshi:fix/textbox-multiline-height

Conversation

@iwatakeshi
Copy link
Contributor

This pull request updates the TextBox.axaml control template to improve layout flexibility and ensure child elements can stretch to fill available space. The main change is replacing StackPanel containers with Grid, allowing for better alignment and sizing of the text box content and associated elements.

Layout improvements:

  • Replaced StackPanel with Grid as the root container in the control template, enabling content to stretch vertically and better utilize available space.
  • Updated the DataValidationErrors container to use a Grid with defined row structure, allowing the Border and Hint elements to align and stretch appropriately. [1] [2]

Style adjustments:

  • Changed the style selector from StackPanel to Grid to ensure the cursor style is applied correctly to the new layout container.

…ht stretching

The TextBox template was using StackPanel to wrap the content, which doesn't
stretch children to fill available space. This caused multiline TextBoxes
with explicit Height to only display ~36px of editable area instead of the
full height.

Changes:
- Replace outer StackPanel with Grid (RowDefinitions='Auto,*')
- Replace inner StackPanel with Grid (RowDefinitions='*,Auto')
- Add VerticalAlignment='Stretch' to Border
- Remove hard-coded Height binding (let it stretch naturally)
- Update style selector from StackPanel to Grid

This fixes issues when using TextBox with AcceptsReturn=true and explicit
Height for multiline text editing scenarios.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant