views:

286

answers:

1
+1  A: 

Hi Jake!

Snoop to the rescue!

Now that you updated the question I found an interesting code in the DataGridHeaderBorder.cs:

   protected override Size ArrangeOverride(Size arrangeSize)
   {
     //...
     if (padding.Equals(new Thickness()))
     {
       padding = DefaultPadding;
     }
     //...
     child.Arrange(new Rect(padding.Left, padding.Top, childWidth, childHeight));
   }

Where DefaultPadding isn't 0... Even though they don't use standard Padding they arrange the child slightly moved.

How to fix this? Maybe writing your own template for the table header will do the trick. Or you could try negative margins for the image. Don't like neither of this approaches. But I can't find anything better yet.

Anvaka
That has allowed me to see that it occurs in the `DataGridHeaderBorder` which holds the `ContentPresenter` (the parent of the `Button`). None of the properties indicate where the padding originates. Ugh.
Jake Wharton
See screenshots posted in the original post.
Jake Wharton
Updated the answer.
Anvaka
Thanks! Solution posted above.
Jake Wharton
Excellent :)! I'm glad you found it! Cheers.
Anvaka