DHancock / WinUI3Controls

A WinUI 3 control library
The Unlicense
16 stars 3 forks source link

Text boxes within groupboxes not stretching properly #49

Open cxnky opened 2 months ago

cxnky commented 2 months ago

I have the following XAML

 <w3c:GroupBox Grid.Row="0" Grid.Column="0" Heading="test" HorizontalAlignment="Stretch" VerticalAlignment="Top" MinWidth="300">
     <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
         <Grid.RowDefinitions>
             <RowDefinition Height="Auto" />
             <RowDefinition Height="Auto" />
         </Grid.RowDefinitions>
         <Grid.ColumnDefinitions>
             <ColumnDefinition Width="Auto" />
             <ColumnDefinition Width="*" />
         </Grid.ColumnDefinitions>

         <TextBox x:Name="Test" Header="Test ID:" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Top" Grid.Row="0" />

         <TextBox x:Name="Test2" Header="Test ID:" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Top" Grid.Row="1" Margin="0,10,0,0" />
     </Grid>
 </w3c:GroupBox>

and the Stretch property is not working properly, as I just see this image

The textboxes do, however, resize when you type in them image

DHancock commented 1 month ago

Instead of setting the GroupBox property HorizontalAlignment="Stretch" you should set HorizontalContentAlignment="Stretch"

That should fix the problem you are seeing.