Reputation: 3
I'm trying to have a stackpanel of radio buttons on the left, a button on the right, both of fixed width, and a text box between them that stretches to fill the space as the window is resized.
This is what seems like should work:
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel HorizontalAlignment="Left">
<RadioButton GroupName="FibOptions" IsChecked="True">Term Closest To N:</RadioButton>
<RadioButton GroupName="FibOptions">Nth Term:</RadioButton>
</StackPanel>
<TextBox x:Name="FibInput" Grid.Column="1" />
<Button Grid.Column="2" x:Name="FibGen" HorizontalAlignment="Right">Generate</Button>
</Grid>
But the above results in a tiny text box that's basically a vertical line right in the middle of the area. Any help with this?
Upvotes: 0
Views: 1169
Reputation: 4166
Set the column width to *
, which tells it to fill the remaining space, and set the other two to auto
:
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" />
Upvotes: 5