DisplayMemberPath ne travaille pas dans WPF

Je veux afficher CustomerList\CustomerName éléments de propriété à la ListBox à l'aide de ItemsSource DisplayMemberPath propriété seulement. Mais ça ne fonctionne pas. Je ne veux pas utiliser DataContext ou toute autre liaison à mon problème. S'il vous plaît aider.
Mon code est donné ci-dessous:

MainWindow.xaml.cs

namespace BindingAnItemControlToAList
{
///<summary>
///Interaction logic for MainWindow.xaml
///</summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
public class Customer
{
public string Name {get;set;}
public string LastName { get; set; }
}
public class CustomerList 
{ 
public List<Customer> Customers { get; set; }
public List<string> CustomerName { get; set; }
public List<string> CustomerLastName { get; set; }
public CustomerList() 
{ 
Customers = new List<Customer>();
CustomerName = new List<string>();
CustomerLastName = new List<string>();
CustomerName.Add("Name1");
CustomerLastName.Add("LastName1");
CustomerName.Add("Name2");
CustomerLastName.Add("LastName2");
Customers.Add(new Customer() { Name = CustomerName[0], LastName = CustomerLastName[0] });
Customers.Add(new Customer() { Name = CustomerName[1], LastName = CustomerLastName[1] });
} 
} 
}
**MainWindow.Xaml**
<Window x:Class="BindingAnItemControlToAList.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BindingAnItemControlToAList"
Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded" >
<Window.Resources>
<local:CustomerList x:Key="Cust"/>
</Window.Resources>
<Grid Name="Grid1">
<ListBox ItemsSource="{Binding Source={StaticResource Cust}}"  DisplayMemberPath="CustomerName" Height="172" HorizontalAlignment="Left" Margin="27,23,0,0" Name="lstStates" VerticalAlignment="Top" Width="245" />
</Grid>
</Window>
InformationsquelleAutor WpfBee | 2012-10-21