<Window x:Class="Tabela.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        Title="MainWindow" Height="400" Width="650" Name="winTable">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <DataGrid x:Name="dgrMain" ItemsSource="{Binding Path=Studenti}" IsReadOnly="True" AutoGenerateColumns="False" IsSynchronizedWithCurrentItem="True">
            <DataGrid.Columns>
                <DataGridTemplateColumn Header="Indeks" Width="Auto">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding Indeks}"/>
                            </StackPanel>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTextColumn Header="Ime" Width="Auto" Binding="{Binding Ime}"></DataGridTextColumn>
                <DataGridTextColumn Header="Prezime" Width="Auto" Binding="{Binding Prezime}"></DataGridTextColumn>
            </DataGrid.Columns>

            <DataGrid.GroupStyle>
                <GroupStyle>
                    <GroupStyle.HeaderTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding Name}" FontWeight="Bold"/>
                            </StackPanel>
                        </DataTemplate>
                    </GroupStyle.HeaderTemplate>
                </GroupStyle>
            </DataGrid.GroupStyle>
        </DataGrid>
        <Grid Grid.Column="0" Grid.Row="1" DataContext="{Binding ElementName=dgrMain,Path=SelectedItem}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Column="0" Grid.Row="0">Indeks:</TextBlock>
            <TextBlock Grid.Column="0" Grid.Row="1">Ime:</TextBlock>
            <TextBlock Grid.Column="0" Grid.Row="2">Prezime:</TextBlock>
            <TextBlock Grid.Column="0" Grid.Row="3">Mail:</TextBlock>
            <TextBlock Grid.Column="0" Grid.Row="4">Upisan/a:</TextBlock>

            <TextBox Grid.Column="1" Grid.Row="0" Text="{Binding Path=Indeks}"></TextBox>
            <TextBox Grid.Column="1" Grid.Row="1" Text="{Binding Path=Ime}"></TextBox>
            <TextBox Grid.Column="1" Grid.Row="2" Text="{Binding Path=Prezime}"></TextBox>
            <TextBox Grid.Column="1" Grid.Row="3" Text="{Binding Path=Email}"></TextBox>
            <CheckBox Grid.Column="1" Grid.Row="4" IsChecked="{Binding Path=Upisan}"/>

            <CheckBox DataContext="{Binding ElementName=winTable, Path=DataContext}" Grid.Column="1" Grid.Row="5" Name="cbGrupisanje" HorizontalAlignment="Right" IsChecked="{Binding Path=GroupView}">Grupisanje</CheckBox>
        </Grid>

    </Grid>

</Window>

