My WPF DataGrid columns are not lining up with the headers. Any idea why?
http://picasaweb.google.com/lh/photo/CahvlINknhL5ykIW2zCfIw?feat=d开发者_开发技巧irectlink
More Info:
http://sweux.com/blogs/smoura/index.php/wpf/2009/04/27/wpf-toolkit-datagrid-part-ii-custom-styling/
I had this issue pop up when I programatically generated a Generic.xaml file using the technique if found here!.
I didn't have a default margin called out, but when I took the width off auto the problem seemed to have gone away.
<!--<Button Command="SelectAll" Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=DataGrid, ResourceId=DataGridSelectAllButtonStyle}}" Width="Auto" Visibility="Visible" Focusable="False" />-->
<Button Command="SelectAll" Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=DataGrid, ResourceId=DataGridSelectAllButtonStyle}}" Width="5" Visibility="Visible" Focusable="False" />
Putting a margin around the default style for Button causes this.
精彩评论