WPF - Binding to current item from within group header style

前端 未结 2 2140
渐次进展
渐次进展 2021-02-14 21:53

I\'m something of a WPF noob so please take it easy on me ;-)

I am trying to create a grouped DataGrid (WPF toolkit version). I have successfully created the data sourc

2条回答
  •  佛祖请我去吃肉
    2021-02-14 22:10

    Thanks for your reply. I really appreciate it and will check it out to see if it works.

    Anyway, as it turns out, after some poking and prodding, I have worked it out using XAML only. What I had been missing was the fact that each item the group header is bound to is a GroupItem and that the default DataContext of a GroupItem is a CollectionViewGroup. In turn, a CollectionViewGroup has an Items property, which is a collection and I can therefore get the Assign_To value of the first item in the collection and use that in my header text. Like this:

    
    

提交回复
热议问题