0
votes

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?

1

1 Answers

5
votes

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" />