So I have a datagrid with a column based off a property called 'Category'. Now depending on the value of that property I want the DataTemplate for the GroupHeader to be different. I am unsure of how to obtain the value of 'Category' for each group. I was unable to find any examples of how to use GroupHeaderTemplateSelector however I have this example of how to use CellContentTemplateSelector below. In this example the method takes a parameter 'object item'. In the context of a cell selector it is apparent that this item is the Object from the ItemsSource list that the grid is being generated from. A group is a collection of objects from that list though so I am unsure what the equivalent method for GroupHeaderTemplateSelector would return as it's 'object item' so that I can access the 'Category' property that the group is being built from. Any help is appreciated!
protected override Windows.UI.Xaml.DataTemplate SelectTemplateCore(object item, Windows.UI.Xaml.DependencyObject container)
{
if ((item as CustomObject).Flag == null)
{
return this.NoImageFoundTemplate;
}
else
{
return this.ImageTemplate;
}
}