2

Is it possible to get controls to automatically divide a space in thirds as the window resizes? It is easy enough to do in code, but I'd like to set the parameters directly in the xaml if possible.

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Nathan Tornquist
  • 6,468
  • 10
  • 47
  • 72

1 Answers1

5

Use the Grid control. It takes up whatever space is available. You can get thirds by doing (assuming you want three columns)

<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinitions Width="*"/>
        <ColumnDefinitions Width="*"/>
        <ColumnDefinitions Width="*"/>
    </Grid.ColumnDefinitions>
    <Button Grid.Column="0"/>
    <Button Grid.Column="1"/>
    <Button Grid.Column="2"/>
</Grid>
Shawn Kendrot
  • 12,425
  • 1
  • 25
  • 41