Hello
I looked for on the web during a long time and I can't find my answer.
I have two classes:
1) Customer: Customercollection which inherits from ObservableCollection.
It contains dependency property:
String Cname;
String Cemail;
OrdersCollection Orders;
2) Orders: OrdersCollection which inherits from ObservableCollection.
It contains dependency property:
Double Amount;
String Seller;
My problem: I would like to group in a listview my Customercollection with the property group CName.
<local:MainWindow x:Key="DebutDataSource"/>
<CollectionViewSource x:Key="ClientCollectionSelectedView" Source="{Binding Customers, Mode=Default, Source={StaticResource DebutDataSource}}">
<CollectionViewSource.GroupDescriptions>
<PropertyGroupDescription PropertyName="Cname"/>
</CollectionViewSource.GroupDescriptions>
And after, I use my Listview:
<ListView Background="Black" localStretch:ListViewColumns.Stretch="true" ItemsSource="{Binding Source={StaticResource ClientCollectionSelectedView}, Mode=Default}" IsSynchronizedWithCurrentItem="True" ItemContainerStyle="{DynamicResource ListViewItemStyle}" >
<ListView.GroupStyle>
<GroupStyle>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Margin" Value="0,0,0,5"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander IsExpanded="True" BorderBrush="#FFA4B97F"
BorderThickness="0,0,0,1">
<Expander.Header>
<DockPanel>
<TextBlock FontWeight="Bold" Text="{Binding Path=Name}"
Margin="5,0,0,0" Width="100" Foreground="{DynamicResource TitreColor}"/>
<TextBlock FontWeight="Bold"
Text="{Binding Path=ItemCount}" Foreground="{DynamicResource TitreColor}"/>
</DockPanel>
</Expander.Header>
<Expander.Content>
<ItemsPresenter />
</Expander.Content>
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</ListView.GroupStyle>
<ListView.View>
<GridView ColumnHeaderContainerStyle="{DynamicResource GridViewColumnHeaderStyle1}">
<GridViewColumn>
<TextBlock Text="Numéro commande" Foreground="{DynamicResource TitreColor}" FontSize="14.667" FontWeight="Bold"/>
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path= Orders/Amount}" Foreground="{DynamicResource TitreColor}"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
My problem is when I have two orders for one customer, it only shows the first order. Not the second.