tags:

views:

245

answers:

2

What happened to DataGridColumnHeader? It looks like it was dropped when the DataGrid was moved into PresentationFramework.

A: 

Something like

<DataGrid ItemsSource="{Binding}">
    <DataGrid.Columns>
        <DataGridTextColumn Header="Column Name" Binding="{Binding Name, Mode=TwoWay}" />
    </DataGrid.Columns>
</DataGrid>
TFD
DataGridColumnHeader was used for custom styling across all headers.
Jonathan Allen
Yeah, that's all in WPF styles. What's your specific problem?
TFD
+3  A: 

DataGridColumnHeader is under the System.Windows.Controls.Primitives namespace in the PresentationFramework.dll assembly.

Jeff Yates
Oh, they changed the namespace to System. I wonder why I didn't see that before.
Jonathan Allen
@Jonathan: Sometimes it's hard to see the wood for the trees. Glad I could help.
Jeff Yates
How do you reference it in XAML?
Tom
@Tom: Same as any other type, include its namespace and then reference it via that. Is there a specific scenario where this isn't working?
Jeff Yates
MSDN doesn't show a namespace in the xaml example.Tried xmlns:prim="clr-namespace:System.Windows.Controls.Primitives;assembly=PresentationFramework", doesn't work. <Style x:Key="{x:Type DataGridRowHeader}" TargetType="{x:Type DataGridRowHeader}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type DataGridRowHeader}"> <Grid> <prim:DataGridHeaderBorder ...The only way I can get it to compile is by cheating and using the WPFToolkit xmlns.
Tom
Perhaps I should make a new question so I can format my text :)
Tom
Did you make sure you have a reference to the DLL? It's working for me, so I'm not sure what's going on.
Jeff Yates
http://stackoverflow.com/questions/3365350/wpf4-datagridheaderborder-in-a-xaml-style
Tom