<ListBox ItemsSource="{Binding}">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Content">
<Setter.Value>
<TextBlock Text="{Binding Name}" />
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
DataContext = new[] { new A { Name = "a" }, new A { Name = "b" }, new A { Name = "c" } };
}
}
public class A
{
public string Name { get; set; }
}
PExpc3RCb3ggSXRlbXNTb3VyY2U9IntCaW5kaW5nfSI+CiAgICA8TGlzdEJveC5JdGVtQ29udGFpbmVyU3R5bGU+CiAgICAgICAgPFN0eWxlIFRhcmdldFR5cGU9Ikxpc3RCb3hJdGVtIj4KICAgICAgICAgICAgPFNldHRlciBQcm9wZXJ0eT0iQ29udGVudCI+CiAgICAgICAgICAgICAgICA8U2V0dGVyLlZhbHVlPgogICAgICAgICAgICAgICAgICAgIDxUZXh0QmxvY2sgVGV4dD0ie0JpbmRpbmcgTmFtZX0iIC8+CiAgICAgICAgICAgICAgICA8L1NldHRlci5WYWx1ZT4KICAgICAgICAgICAgPC9TZXR0ZXI+CiAgICAgICAgPC9TdHlsZT4KICAgIDwvTGlzdEJveC5JdGVtQ29udGFpbmVyU3R5bGU+CjwvTGlzdEJveD4KCgpwdWJsaWMgcGFydGlhbCBjbGFzcyBNYWluV2luZG93IDogV2luZG93CnsKICAgIHB1YmxpYyBNYWluV2luZG93KCkKICAgIHsKICAgICAgICBJbml0aWFsaXplQ29tcG9uZW50KCk7CiAgICAgICAgRGF0YUNvbnRleHQgPSBuZXdbXSB7IG5ldyBBIHsgTmFtZSA9ICJhIiB9LCBuZXcgQSB7IE5hbWUgPSAiYiIgfSwgbmV3IEEgeyBOYW1lID0gImMiIH0gfTsKICAgIH0KfQoKcHVibGljIGNsYXNzIEEKewogICAgcHVibGljIHN0cmluZyBOYW1lIHsgZ2V0OyBzZXQ7IH0KfQogICAg