title: DataGridRow border on top of DataGrid border
body: <p>I'm trying to display DataGridRow border on top of DataGrid border. Is that even possible with a style or I have to use a custom adorner?</p>
  <p><a href="https://i.stack.imgur.com/8uWgP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8uWgP.png" alt="enter image description here" /></a></p>
  <p>I want to achieve something like that:</p>
  <p><a href="https://i.stack.imgur.com/sVV2I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sVV2I.png" alt="enter image description here" /></a></p>
  <p>I tried using <code>Panel.ZIndex</code> and <code>ClipToBounds=&quot;False&quot;</code> but it doesn't seem to work in this case.</p>
  <pre><code>&lt;Style x:Key=&quot;MyDataGridRowStyle&quot; TargetType=&quot;{x:Type DataGridRow}&quot;&gt;
      &lt;Setter Property=&quot;SnapsToDevicePixels&quot; Value=&quot;true&quot; /&gt;
      &lt;Setter Property=&quot;Validation.ErrorTemplate&quot; Value=&quot;{x:Null}&quot; /&gt;
      &lt;Setter Property=&quot;ValidationErrorTemplate&quot;&gt;
          &lt;Setter.Value&gt;
              &lt;ControlTemplate&gt;
                  &lt;TextBlock
                      Margin=&quot;2,0,0,0&quot;
                      VerticalAlignment=&quot;Center&quot;
                      Foreground=&quot;Red&quot;
                      Text=&quot;!&quot; /&gt;
              &lt;/ControlTemplate&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
      &lt;Setter Property=&quot;Template&quot;&gt;
          &lt;Setter.Value&gt;
              &lt;ControlTemplate TargetType=&quot;{x:Type DataGridRow}&quot;&gt;
                  &lt;Border
                      x:Name=&quot;DGR_Border&quot;
                      Background=&quot;{TemplateBinding Background}&quot;
                      BorderBrush=&quot;{TemplateBinding BorderBrush}&quot;
                      BorderThickness=&quot;{TemplateBinding BorderThickness}&quot;
                      ClipToBounds=&quot;False&quot;
                      SnapsToDevicePixels=&quot;True&quot;&gt;
                      &lt;SelectiveScrollingGrid&gt;
                          &lt;Grid.ColumnDefinitions&gt;
                              &lt;ColumnDefinition Width=&quot;Auto&quot; /&gt;
                              &lt;ColumnDefinition Width=&quot;*&quot; /&gt;
                          &lt;/Grid.ColumnDefinitions&gt;
  
                          &lt;Grid.RowDefinitions&gt;
                              &lt;RowDefinition Height=&quot;*&quot; /&gt;
                              &lt;RowDefinition Height=&quot;Auto&quot; /&gt;
                          &lt;/Grid.RowDefinitions&gt;
  
                          &lt;DataGridCellsPresenter
                              Grid.Column=&quot;1&quot;
                              ItemsPanel=&quot;{TemplateBinding ItemsPanel}&quot;
                              SnapsToDevicePixels=&quot;{TemplateBinding SnapsToDevicePixels}&quot; /&gt;
  
                          &lt;DataGridDetailsPresenter
                              Grid.Row=&quot;1&quot;
                              Grid.Column=&quot;1&quot;
                              SelectiveScrollingGrid.SelectiveScrollingOrientation=&quot;{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, Path=AreRowDetailsFrozen, Converter={x:Static DataGrid.RowDetailsScrollingConverter}, ConverterParameter={x:Static SelectiveScrollingOrientation.Vertical}}&quot;
                              Visibility=&quot;{TemplateBinding DetailsVisibility}&quot; /&gt;
  
                          &lt;DataGridRowHeader
                              Grid.RowSpan=&quot;2&quot;
                              SelectiveScrollingGrid.SelectiveScrollingOrientation=&quot;Vertical&quot;
                              Visibility=&quot;{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, Path=HeadersVisibility, Converter={x:Static DataGrid.HeadersVisibilityConverter}, ConverterParameter={x:Static DataGridHeadersVisibility.Row}}&quot; /&gt;
                      &lt;/SelectiveScrollingGrid&gt;
                  &lt;/Border&gt;
              &lt;/ControlTemplate&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
      &lt;Style.Triggers&gt;
          &lt;Trigger Property=&quot;IsNewItem&quot; Value=&quot;True&quot;&gt;
              &lt;Setter Property=&quot;Margin&quot; Value=&quot;{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, Path=NewItemMargin}&quot; /&gt;
          &lt;/Trigger&gt;
          &lt;Trigger Property=&quot;IsSelected&quot; Value=&quot;True&quot;&gt;
              &lt;Setter Property=&quot;BorderThickness&quot; Value=&quot;1&quot; /&gt;
              &lt;Setter Property=&quot;BorderBrush&quot; Value=&quot;Red&quot; /&gt;
              &lt;Setter Property=&quot;Margin&quot; Value=&quot;-1,-1,-1,-1&quot; /&gt;
              &lt;Setter Property=&quot;Panel.ZIndex&quot; Value=&quot;123&quot; /&gt;
          &lt;/Trigger&gt;
      &lt;/Style.Triggers&gt;
  &lt;/Style&gt;
  </code></pre>