I have class "Person" that look like this:
public class Person
{
public string Name { get; set; }
public int Age { get; set; }
public string Country{ get; set; }
public List<Person> Children { get; set; }
}
I want to create a TreeView in WPF that will present the Persons by Country.
For example:
- New york
- Bob
- New York
- Ethan
- Owen
- Canada
- Benjamin
- James
- New York
- Kevin
- Paris
- Louis
- Paris
- William
- Bob
- Finland
- Oliver
- Hungary
- Ben
- Paul
- Iceland
- Arthur
- Benjamin
- Arthur
- England
- Gabriel
- Victor
- Hungary
- Eino
- Paris
- Gabriel
- Adam
- Paris
- Emma
- Oliver
My TreeView :
<TreeView.Resources>
<HierarchicalDataTemplate ItemsSource="{Binding People}" DataType="{x:Type Person}">
<Label Content="{Binding Name}"></Label>
</HierarchicalDataTemplate>
Is there someway to use "Group by" in tree view?
Aucun commentaire:
Enregistrer un commentaire