B_old B_old - 1 year ago 194
C# Question

WPF DataGrid Text wrapping in headers and elsewhere

I want to enable text wrapping in the WPF DataGrid column headers and the content of the rows.
Searching for solutions, I often stumble over something like this. The problem is, that it is not working for me.

First of all I have problems with this line:


I get errors about the assembly not being found.
More problems with the rest of the XAML-code.

<Style TargetType="{x:Type primitives:DataGridColumnHeader}">
<Setter Property="ContentTemplate">
<TextBlock TextWrapping="Wrap" Text="{Binding}"></TextBlock>

I place this inside the DataGrid tag, otherwise it won't compile. I also omit the "primitives"-namespace as I did not actually include it (see above). Now it compiles. However the application throws some exception in the constructor of the window. Any idea how I can get this thing to actually work?

Answer Source
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download