开发者

WPF - Get DataGridColumn from its DataGridColumnHeader

I need to get the exact DataGridColumn that is associated with the DataGridColumnHeader. So, basically: fill in the gaps in the following code: :)

DataGridColumnHea开发者_如何转开发der myHeader; // this is a given value
DataGridColumn myColumn = SomeCoolMethod(myHeader);

public DataGridColumn SomeCoolMethod(DataGridColumnHeader header)
{
    // ???
}

Ok, some more text - I can travel up the visual tree but it seems, that the real headers are contained in a separate branch or something. I get to my DataGrid visual without encountering any DataGridColumns. I am not sure where to search for the initial column and then - how do I find this specific column that caused the header?


Just use the Column property:

public DataGridColumn SomeCoolMethod(DataGridColumnHeader header)
{
    return header.Column;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜