Wednesday, 7 November 2012

Enabling Word Wrap in the WPF DataGrid Column Headers

To enable Word Wrapping in the WPF Data Grid Column Header, simply add the following code snippet to your Application.xaml file;

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

No comments:

Post a Comment