Reputation: 19
I have stackpanel with three buttons.. like below
<stackpanel orientation="Horizontal">
<Button Content="btnone" width="100" height="50"/>
<Button Content="btntwo" width="100" height="50"/>
<Button Content="btnthree" width="100" height="50"/>
</stackpanel>
when i change the window size the buttons will be resized to cover entire window width.. Assume that currently my window width is 300.. Kindly help me..
Upvotes: 1
Views: 3824
Reputation: 10152
A Grid
panel would probably be more appropriate here than a StackPanel
. If I understand your question correctly, then this will do what you want:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Content="One" Grid.Column="0" Height="50" Margin="10"/>
<Button Content="Two" Grid.Column="1" Height="50" Margin="10"/>
<Button Content="Three" Grid.Column="2" Height="50" Margin="10"/>
</Grid>
Upvotes: 3