Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Person
- {
- public string Name { get; set; }
- public int Age { get; set; }
- }
- public ObservableCollection<Person> Collection { get; set; }
- public List<Person> Persons { get; set; }
- private void WindowLoaded(object sender, RoutedEventArgs e)
- {
- this.Persons = new List<Person>();
- for (int i = 0; i != 35; i++)
- {
- this.Persons.Add(new Person() {Age = i, Name = i.ToString()});
- }
- this.Collection = new ObservableCollection<Person>(this.Persons);
- }
- <Grid DataContext="{Binding ElementName=TestWindow, Path=.}">
- <DataGrid x:Name="DataGrid" ItemsSource="{Binding Collection}" />
- </Grid>
- <Grid DataContext="{Binding ElementName=TestWindow, Path=.}">
- <DataGrid x:Name="DataGrid" ItemsSource="{Binding Persons}" />
- </Grid>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement