How to Programmatically Set the Column Header Height

May 26, 2009 at 6:25 PM

Hi there.

I have another post where I've gotten a ton of good advice on how to programmatically build a column header.  

I do have one issue, how to a set the height of the column header row programmatically?

I build a column, then a stack panel with my  header contents. Then I assign the stackpanel to the new Column's header.  This works but I cannot seem to set the size fo the column header to automatically scale to the new height of the header stack panel.

headerStackPanel.Height = double.NaN;

newColumn1.Header = headerStackPanel; 



I'm sure I am missing something simple,


Aug 4, 2009 at 7:29 AM

i have the same problem

Aug 4, 2009 at 8:44 AM
Edited Aug 4, 2009 at 11:18 AM

so easy

Microsoft::Windows::Controls::Primitives::DataGridColumnHeadersPresenter^ hdr

= WpfGuiHelpers::LogicalTreeHelper::FindVisualChild<Microsoft::Windows::Controls::Primitives::DataGridColumnHeadersPresenter>(this);

hdr->Height = 22;

only problem this will change column header height only = if you have any text inside header it will stay too down = partly invisible even there is enough empty room over it