I have the following Data class:
class CustomerProducts
{
public string Id { get; set; }
public List<ProductId> Products { get; set; }
}
And the following XAML:
<DataGrid Name="grd_CustomerProducts" ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=my:MainWindow, AncestorLevel=1}, Path=CustomerOverview}" />
NB: CustomerOverview is an ObservableCollection<CustomerProducts> within the Main Window
I am looking to bind the CustomerOverview collection to a DataGrid such that you get the Customer ID and a Count of all the Id’s in Products. e.g:
Id……..| Number Of Products
0001a | 3
bb032 | 0
3rt640 | 99
How can I change my XAML to achieve this, or do I need to implement something else?
Just add columns manually with proper Binding: