DataGrid: Style AutoGenerateColumns=False is not working

Oct 6, 2009 at 5:34 PM


If I use a style to set some properties, AutoGenerateColumns seems not to have any effect if value="False" !? Other properties MinHeight/MaxHeight etc. works. Allways columns are generated. Setting the AutoGenerateColumns-property directly to False works.

<!-- Default style for all DataGrids -->
<Style TargetType="DataGrid">
   <Setter Property="MinHeight" Value="46"/>
   <Setter Property="MaxHeight" Value="150"/>
   <Setter Property="AutoGenerateColumns" Value="False"/>  <!-- No effect! -->
   <Setter Property="HorizontalScrollBarVisibility" Value="Disabled"/>

Maybe I'm wrong or a bug. Any ideas?

Best regards Kay