Customize DataGrid Group Name
I'm using the Silverlight Toolkit DataGrid. Grouping is working fine, thanks to the PagedCollectionView
class.
My question is, is there an easy way to customize the text of the group header? 开发者_如何学Go When I group by "CurrentBook.SubTitle"
(just testing it out - grouping by a book's subtitle doesn't actually make sense) it displays "CurrentBook.SubTitle" in the group header of the grid, when I'd prefer just SubTitle.
Obviously I could just make a new property in my ViewModel called SubTitle that passes along CurrentBook.SubTitle, but I'm just wondering if there is any built-in way to affect the group header text.
Its a little difficult to answer this without seeing an example of your code. Follow the advice here and make a style for the DataGridRowGroupHeader
with something like PropertyName="{Binding Collection Path=Name}"
and add that style to the RowGroupHeaderStyles
Property. Im not sure how much more specific I can get without seeing more though.
精彩评论