2016-06-13 8 views
0

私が持っている三つのボタン付きのStackPanel ..私は、ウィンドウのサイズを変更したときにボタンがウィンドウ全体の幅をカバーするためにリサイズされます WPFのボタンの幅ウィンドウサイズに基づいて

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

の下に...その現在、私の窓を想定ように幅は300です。

答えて

2

GridここでパネルはおそらくStackPanelより適切でしょう。私が正しくあなたの質問を理解していれば、これはあなたがやりたいことになります。

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

enter image description here

+0

を実際に私は、グリッドの最初の行のことのStackPanelを持っている... A.Manikandan @ B.K –

+0

と? StackPanelではなく、その行の中にGridを置くことができます。 StackPanelでは、達成したいことがもっと難しくなると言っています。私はあなたの質問にそれを提供していないので、あなたのレイアウト全体を知らない。 –

+0

OK B.Kありがとうございます.. –

関連する問題