1

I try to stylize DataGridTextColumn setting Header and Cell styles separatly:

   <Style x:Key="headerStyle">
            <Setter Property="DataGridColumnHeader.Background" ... />
   ...

    <Style x:Key="cellStyle">
            <Setter Property="DataGridCell.Background" ... />
  ...


<DataGrid>
  <DataGrid.Columns>
     <DataGridTextColumn 
          HeaderStyle="{StaticResource ResourceKey='headerStyle'}" 
          CellStyle="{StaticResource ResourceKey='cellStyle'}" ... />

Can I stylize DataGridTextColumn Header, Cell and other properties in one style declaration?

Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
Andrew Florko
  • 7,672
  • 10
  • 60
  • 107

1 Answers1

0

As far as i can tell that might be impossible since DataGridTextColumn does not provide a Template or Style property of its own which could be used to set the other styles collectively.

H.B.
  • 166,899
  • 29
  • 327
  • 400
  • It supplies an ElementStyle property which *should* work, but it doesn't :-( – HiredMind Sep 14 '11 at 15:42
  • @HiredMind: [`ElementStyle`](http://msdn.microsoft.com/en-us/library/system.windows.controls.datagridboundcolumn.elementstyle.aspx) if for the cells not the column itself. – H.B. Sep 14 '11 at 18:38