fork download
  1. <ListBox ItemsSource="{Binding}">
  2. <ListBox.ItemContainerStyle>
  3. <Style TargetType="ListBoxItem">
  4. <Setter Property="Content">
  5. <Setter.Value>
  6. <TextBlock Text="{Binding Name}" />
  7. </Setter.Value>
  8. </Setter>
  9. </Style>
  10. </ListBox.ItemContainerStyle>
  11. </ListBox>
  12.  
  13.  
  14. public partial class MainWindow : Window
  15. {
  16. public MainWindow()
  17. {
  18. InitializeComponent();
  19. DataContext = new[] { new A { Name = "a" }, new A { Name = "b" }, new A { Name = "c" } };
  20. }
  21. }
  22.  
  23. public class A
  24. {
  25. public string Name { get; set; }
  26. }
  27.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(1,0): error CS1525: Unexpected symbol `<'
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty