Take a look at the image... notice how the grid that contains the text and the button overflows into the next column. Why is it doing that?
<DataGridTemplateColumn Header="Device" Width="*" SortMemberPath="Name" x:Name="DeviceColumn" >
<DataGridTemplateColumn.HeaderTemplate>
<DataTemplate>
<Grid Width="{Binding ElementName=DeviceColumn, Path=ActualWidth}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Device" Grid.Column="0" HorizontalAlignment="Left"/>
<Button Name="FilterButton" Content="..." Width="30" Background="Transparent" Click="FilterColumn" Grid.Column="2" BorderBrush="Transparent" HorizontalAlignment="Right" />
</Grid>
</DataTemplate>
</DataGridTemplateColumn.HeaderTemplate>```
You probably have a Style defined that either affects the Grid
(with a -2 Margin for example) or DataGridColumnHeader
.