DataGrid Column header height
I just want to know if it's possible to change the height of the column header in a DataGrid. I have found options for bouth height and width og the row header, but only width option for the column header.
Is it changable, and in that case; how do I change it?
(I need to write two lines of text in the header, and if I can't change the header height, the bottom line will not be shown)
Thanks for all answers! I am really stuck here... :(
Re: DataGrid Column header height
So I've been unable to find anything on this for two days now and finally decided just go ahead and manually come up with a solution. First I added a thumb to the bottom of the header then I added a couple of event handlers to give the expected functionality:
private void Thumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
{
double change = e.VerticalChange;
RulesGrid.ColumnHeaderHeight = Math.Max(20, RulesGrid.ColumnHeaderHeight + change);
}
private void Thumb_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
RulesGrid.ColumnHeaderHeight = double.NaN;
}
I hope that helps. I really can't understand why this has to be added in the first place...
Re: DataGrid Column header height
This is a more complete answer.
private void Thumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
{
double change = e.VerticalChange;
RulesGrid.ColumnHeaderHeight = double.IsNaN(RulesGrid.ColumnHeaderHeight) ? mousePosition.Y : // mouse position gotten from
Math.Max(20, RulesGrid.ColumnHeaderHeight + change);
}
private void Thumb_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
RulesGrid.ColumnHeaderHeight = double.NaN;
}