title: wpf datagrid customization (border, cell corners, etc.)
body: <p>i'm trying to style a wpf datagrid in xaml to make it look like <a href="http://imgur.com/j0ROUVV" rel="noreferrer">this image</a>. Is that possible?
  I tried numerous things, but i still have the following problems:</p>
  
  <ol>
  <li>Cell border property only affects selected cells. Otherwise i only have the 1px thin lines which can be coloured via VerticalGridLinesBrush</li>
  <li>If I specifiy a background color on datagrid.cell level it overlays the selection</li>
  <li>I have no idea if rounded edges on cell level (also for selections) is even possible</li>
  </ol>
  
  <p>I'm grateful four any help. If it helps i can post a couple of tries here tomorrow.</p>
  
  <p>Edit:
  This is my code generating the datagrid, as you can see I experimented with background and margin values in datagrid.cellstyle, however it resulted in the above problems:</p>
  
  <pre><code>&lt;DataGrid x:Name="Grid" Height="305" VerticalAlignment="Top" Width="505" BorderThickness="1" 
        AutoGenerateColumns="False" SelectionUnit="Cell" HeadersVisibility="None" ItemsSource="{Binding}" 
        CanUserSortColumns="False" CanUserResizeColumns="False" CanUserReorderColumns="False" CanUserResizeRows="False" 
        IsReadOnly="True" HorizontalAlignment="Left" BorderBrush="White" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled" 
        ScrollViewer.CanContentScroll="False" MouseLeftButtonUp="ScreenGrid_MouseLeftButtonUp" Margin="10,10,0,0" Background="#FF000000"
        VerticalGridLinesBrush="White" HorizontalGridLinesBrush="White" SelectedCellsChanged="ScreenGrid_SelectedCellsChanged" &gt;
      &lt;DataGrid.Resources&gt;
          &lt;SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Blue"&gt;&lt;/SolidColorBrush&gt;
          &lt;Style x:Key="DataGridRowStyleColoured" TargetType="{x:Type DataGridRow}"&gt;
              &lt;Setter Property="Background" Value="#FF000000" /&gt;
          &lt;/Style&gt;
      &lt;/DataGrid.Resources&gt;
      &lt;DataGrid.RowStyle&gt;
          &lt;StaticResource ResourceKey="DataGridRowStyleColoured"/&gt;
      &lt;/DataGrid.RowStyle&gt;
      &lt;DataGrid.CellStyle&gt;
          &lt;Style TargetType="DataGridCell"&gt;
              &lt;Setter Property="BorderThickness" Value="0"/&gt;
              &lt;!--&lt;Setter Property="Margin" Value="5,5,5,5"/&gt; --&gt;
              &lt;!-- &lt;Setter Property="Background" Value="White"/&gt; --&gt;
          &lt;/Style&gt;
      &lt;/DataGrid.CellStyle&gt;
  &lt;/DataGrid&gt;
  </code></pre>