Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access GridViewColumnHeader object from GridViewColumn

is it possible in wpf to access the header of a gridviewcolumn as gridviewcolumnheader?

I have an object:

GridViewColumn column;

But the "Header" property just returns a string (header text) not the "real" header object.

Can anyone help my?

like image 969
Marco Avatar asked May 23 '10 00:05

Marco


2 Answers

I am myself very inexperianced with WPF... however it appears that that if you you do not define a GridViewColumnHeader, then you will not be given one when accessing .Header.

That is to say, if you define your GridViewColumn as:

                <GridViewColumn x:Name="stringColumn">
                    stringColumn.Header will return a string
                </GridViewColumn>

Then calling stringColumn.Header will return a string... however if you define it as say:

                <GridViewColumn x:Name="gridViewColumnHeaderColumn1">
                    <GridViewColumnHeader>
                        gridViewColumnHeaderColumn.Header will return a GridViewColumnHeaderColumn
                    </GridViewColumnHeader>
                </GridViewColumn>

Then checking gridViewColumnHeaderColumn.Header will return a GridViewColumnHeaderColumn

like image 70
Brendan Grant Avatar answered Oct 18 '22 16:10

Brendan Grant


I've summarized different ways to find GridViewColumnHeader from GridViewColumn here: http://apaers.com/wpf-listview-access-gridviewcolumnheader-from-gridviewcolumn/

like image 39
elshev Avatar answered Oct 18 '22 15:10

elshev