title: Using uniformgrid to arrange buttons in a square
body: <p>Im writing this childrens game (memory) and have a list of tiles (List) which i bind to an items control inside a wrappanel. Right now i have 22 tiles and they arrange themselves in two rows in the center.</p>
  
  <p>What i really want is to arrange it in a 5x5 matrix in the center of the screen, so it scales with the amount of tiles. I cant get the tiles to show properly, when using the uniform grid, the size is very small and in the top left corner of my screen. When i set the columns and the rows properties it toesnt show up, as if its outside the bounds. Anyone can help?</p>
  
  <p>XAML:</p>
  
  <pre><code>&lt;Window x:Class="MemoryWPF.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          Title="MainWindow" Height="350" Width="525"&gt;
      &lt;Window.Resources&gt;
          &lt;Style TargetType="Button" x:Key="TransparentButton"&gt;
              &lt;Setter Property="Template"&gt;
                  &lt;Setter.Value&gt;
                      &lt;ControlTemplate TargetType="Button"&gt;
                          &lt;Border Background="Transparent"&gt;
                              &lt;ContentPresenter/&gt;
                          &lt;/Border&gt;
                      &lt;/ControlTemplate&gt;
                  &lt;/Setter.Value&gt;
              &lt;/Setter&gt;
          &lt;/Style&gt;
      &lt;/Window.Resources&gt;
      &lt;UniformGrid Columns="5" Rows="5"&gt;
          &lt;UniformGrid.Background&gt;
              &lt;ImageBrush x:Name="backBrush"/&gt;
          &lt;/UniformGrid.Background&gt;        
          &lt;ItemsControl ItemsSource="{Binding Tiles}" VerticalAlignment="Center" HorizontalAlignment="center" Margin="100"&gt;
              &lt;ItemsControl.ItemTemplate&gt;
                  &lt;DataTemplate&gt;
                      &lt;Button Style="{StaticResource TransparentButton}" BorderThickness="0" Padding="-4" Command="{Binding TurnTileCommand}" Opacity="{Binding OpacityVal}" Margin="10"&gt;
                          &lt;Image Width="150" Height="150" Source="{Binding ImageUri}"/&gt;
                      &lt;/Button&gt;
                  &lt;/DataTemplate&gt;
              &lt;/ItemsControl.ItemTemplate&gt;
              &lt;ItemsControl.ItemsPanel&gt;
                  &lt;ItemsPanelTemplate&gt;
                      &lt;WrapPanel/&gt;
                  &lt;/ItemsPanelTemplate&gt;
              &lt;/ItemsControl.ItemsPanel&gt;
          &lt;/ItemsControl&gt;
          &lt;TextBlock Text="{Binding AmountTilesLeft}" VerticalAlignment="Bottom" FontSize="15"/&gt;
      &lt;/UniformGrid&gt;
  &lt;/Window&gt;
  </code></pre>