Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition Width="2*"/>
- <ColumnDefinition Width="3*"/>
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="*"/>
- </Grid.RowDefinitions>
- <ComboBox Grid.Row="0" Grid.Column="0" SelectedItem="{Binding SelectedStudent}" ItemsSource="{Binding Studenti}">
- <ComboBox.ItemTemplate>
- <DataTemplate>
- <TextBlock Text="{Binding Jmeno}" />
- </DataTemplate>
- </ComboBox.ItemTemplate>
- </ComboBox>
- <TextBlock Grid.Row="0" Grid.Column="1" Text="Ahoj" />
- <ListBox Grid.Row="1" Grid.Column="1" ItemsSource="{Binding Polozky}">
- <ListBox.ItemTemplate>
- <DataTemplate>
- <StackPanel>
- <TextBlock Text="{Binding Datum}" />
- <TextBlock Text="{Binding Id}" />
- </StackPanel>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- <DataGrid Grid.Row="0" Grid.Column="2" Grid.RowSpan="3" ItemsSource="{Binding Polozky}" />
- </Grid>
- public class Polozka
- {
- public DateTime Datum { get; set; }
- public int Id { get; set; }
- public Polozka(int id)
- {
- Datum = DateTime.Now.AddHours(id);
- Id = id;
- }
- }
- public class Data
- {
- public List<Polozka> Polozky { get; set; }
- public List<Student> Studenti { get; set; }
- public Student SelectedStudent { get; set; }
- public Data()
- {
- Polozky = new List<Polozka>()
- {
- new Polozka(1),
- new Polozka(2),
- new Polozka(3)
- };
- Studenti = new List<Student>()
- {
- new Student("Adam"),
- new Student("Alena"),
- new Student("Jirka"),
- new Student("Matúš"),
- new Student("Samuel")
- };
- SelectedStudent = Studenti.FirstOrDefault();
- }
- }
- protected override void OnStartup(StartupEventArgs e)
- {
- base.OnStartup(e);
- Data data = new Data();
- MainWindow window = new MainWindow();
- window.DataContext = data;
- window.ShowDialog();
- }
- public class Student
- {
- public string Jmeno { get; set; }
- public Student(string jmeno)
- {
- Jmeno = jmeno;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement