8

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?

Marco
  • 543
  • 3
  • 9
  • 21

2 Answers2

3

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

Brendan Grant
  • 937
  • 7
  • 16
2

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

elshev
  • 1,164
  • 3
  • 16
  • 30