Mega Code Archive
Without specifying a DataTemplate, the ListBox displays a list of names
//File:Window.xaml.cs
using System.Collections.ObjectModel;
namespace WpfApplication1
{
public class Employee
{
public string FirstName
{
get;
set;
}
public int Age
{
get;
set;
}
public string Photo
{
get;
set;
}
public override string ToString()
{
return FirstName;
}
}
public class People : Collection
{
public People()
{
this.Add(new Employee()
{
FirstName = "A",
Age = 26,
Photo = "a.png"
});
this.Add(new Employee()
{
FirstName = "C",
Age = 24,
Photo = "c.png"
});
}
}
}