6

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

akjoshi
  • 15,374
  • 13
  • 103
  • 121
Jonathan Allen
  • 68,373
  • 70
  • 259
  • 447

2 Answers2

5

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

Jeff Yates
  • 61,417
  • 20
  • 137
  • 189
  • Oh, they changed the namespace to System. I wonder why I didn't see that before. – Jonathan Allen Apr 07 '10 at 16:25
  • @Jonathan: Sometimes it's hard to see the wood for the trees. Glad I could help. – Jeff Yates Apr 07 '10 at 16:32
  • How do you reference it in XAML? – Thomas Jul 27 '10 at 17:39
  • @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 Jul 27 '10 at 18:10
  • MSDN doesn't show a namespace in the xaml example. Tried xmlns:prim="clr-namespace:System.Windows.Controls.Primitives;assembly=PresentationFramework", doesn't work. – Thomas Jul 27 '10 at 20:48
  • Perhaps I should make a new question so I can format my text :) – Thomas Jul 27 '10 at 20:49
  • 1
    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 Jul 28 '10 at 14:01
  • 2
    http://stackoverflow.com/questions/3365350/wpf4-datagridheaderborder-in-a-xaml-style – Thomas Jul 29 '10 at 17:28
0

Something like

<DataGrid ItemsSource="{Binding}">
    <DataGrid.Columns>
        <DataGridTextColumn Header="Column Name" Binding="{Binding Name, Mode=TwoWay}" />
    </DataGrid.Columns>
</DataGrid>
TFD
  • 23,890
  • 2
  • 34
  • 51