To expand on tehMick's answer with functional sample code:
XAML:
<Window x:Class="Sandbox.Wpf.PropertyCount.PropertyCount"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Property Count" Height="300" Width="300">
<StackPanel>
<ListView ItemsSource="{Binding Path=People}">
<ListView.ItemTemplate>
<DataTemplate>
<Grid Margin="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Path=Name}" Margin="3" />
<TextBlock Grid.Column="1" Margin="3">
<TextBlock Text="{Binding Path=Addresses.Count}" /> <Run>addresses</Run>
</TextBlock>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackPanel>
</Window>
Code Behind:
namespace Sandbox.Wpf.PropertyCount
{
/// <summary>
/// Interaction logic for PropertyCount.xaml
/// </summary>
public partial class PropertyCount : Window
{
public PropertyCount()
{
InitializeComponent();
this.DataContext = new Model();
}
}
public class Model
{
public List<Person> People { get; private set; }
public Model()
{
People = new List<Person>{
new Person ("joe", new List<object> { 1, 2, 3 }),
new Person ("bob", new List<object> { 1, 2 }),
new Person ("kay", new List<object> { 1, 2, 3, 4, 5 }),
new Person ("jill", new List<object> { 1, 2, 3, 4 }),
};
}
}
public class Person
{
public string Name { get; set; }
public List<object> Addresses { get; set; }
public Person(string name, List<object> addresses)
{
Name = name;
Addresses = addresses;
}
}
}