2017-10-13 15 views
0

私は、達成したいボタンがたくさんあるグリッドを持っているとしましょう。ウィンドウのサイズを変更すると、左上隅にボタンを揃えたいとしますグリッドのサイズが変わり、ボタンが自動的に再配置されます。 私は、Web開発者ですグリッドでの垂直と水平の自動配置WPF

<Grid HorizontalAlignment="Left" VerticalAlignment="Top"> 

     <Grid.Resources> 
      <Style TargetType="{x:Type Button}"> 
       <Setter Property="Width" Value="100" /> 
       <Setter Property="Height" Value="100" /> 

      </Style> 

     </Grid.Resources> 
     <Button Content="Button1" /> 
     <Button Content="Button2" /> 
     <Button Content="Button3" /> 
     <Button Content="Button4" /> 
     <Button Content="Button5" /> 
     <Button Content="Button6" /> 

    </Grid> 

のように私のXAMLコードは次のようになり、それはCSS & HTMLでそれを行うには超簡単です。

https://codepen.io/anon/pen/gGdrJJ

+9

のために有用であろうか? – Sinatr

+0

それは実際に働いた、まあ私は多くの検索をしたので、私はスーパー驚きです、とにかくありがとう。 –

+1

[パネルの概要](https://docs.microsoft.com/en-us/dotnet/framework/wpf/controls/panels-overview)が欠落している可能性があります。 – Clemens

答えて

関連する問題