<UserControl xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" 
    xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" 
    x:Class="MujAdresar.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="35"/>
            <RowDefinition Height="35"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="60"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="60"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="60"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="60"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="60"/>
        </Grid.ColumnDefinitions>

        <Border Background="LightGray" Grid.Column="0" Grid.Row="0"
                Grid.ColumnSpan="9" Grid.RowSpan="2"/>

        <TextBlock Grid.Column="0" Grid.Row="0" Text="Jméno:"
                       HorizontalAlignment="Right" VerticalAlignment="Center"
                       Margin="5,5,5,5"/>

        <TextBox Grid.Column="1" Grid.Row="0" x:Name="textbox_jmeno"                     
                     Width="Auto" Margin="5,5,5,5"/>

        <TextBlock Grid.Column="2" Grid.Row="0" Text="Příjmení:"
                       HorizontalAlignment="Right" VerticalAlignment="Center"
                       Margin="5,5,5,5"/>

        <TextBox Grid.Column="3" Grid.Row="0" x:Name="textbox_prijmeni"
                     Width="Auto" Margin="5,5,5,5"/>

        <TextBlock Grid.Column="4" Grid.Row="0" Text="E-mail:"
                       HorizontalAlignment="Right" VerticalAlignment="Center"
                       Margin="1,1,1,1"/>

        <TextBox Grid.Column="5" Grid.Row="0" x:Name="textbox_email"
                     Width="Auto" Margin="5,5,5,5"/>

        <TextBlock Text="Přezdívka:" Grid.Column="6" Grid.Row="0"
                       HorizontalAlignment="Right" VerticalAlignment="Center"
                       Margin="1,1,1,1"/>

        <TextBox Grid.Column="7" Grid.Row="0" x:Name="textbox_prezdivka"
                     Width="Auto" Margin="5,5,5,5"/>

        <TextBlock Text="Adresa:" Grid.Column="0" Grid.Row="1"
                       HorizontalAlignment="Right" VerticalAlignment="Center"
                       Margin="1,1,1,1"/>

        <TextBox Grid.Column="1" Grid.Row="1" x:Name="textbox_adresa"
                     Grid.ColumnSpan="3"
                     Width="Auto" Margin="5,5,5,5"/>


        <StackPanel Orientation="Horizontal" Grid.Column="4" Grid.Row="1" Grid.ColumnSpan="2"
                        HorizontalAlignment="Center" VerticalAlignment="Center">
            <CheckBox x:Name="checkbox_studuje" Content="studuje" Margin="5,5,5,5"/>
            <CheckBox x:Name="checkbox_pracuje" Content="pracuje" Margin="5,5,5,5"/>
            <CheckBox x:Name="checkbox_plave" Content="plave" Margin="5,5,5,5"/>
        </StackPanel>

        <TextBlock Text="Narození:" Grid.Column="6" Grid.Row="1"
                       HorizontalAlignment="Right" VerticalAlignment="Center"
                       Margin="1,1,1,1"/>


        <basics:DatePicker x:Name="datepicker_narozeniny" Grid.Column="7" Grid.Row="1"
                           HorizontalAlignment="Left" VerticalAlignment="Center"
                           Margin="5,5,5,5"/>
        

        <Button x:Name="tlacitko_uloz" Content="Ulož" Click="tlacitko_uloz_Click"
                    Grid.Column="8" Grid.Row="1" Margin="5,5,5,5"/>

        <!--DataGrid pro vypsani ulozenych dat-->
        <data:DataGrid x:Name="MujDataGrid" ItemsSource="{Binding Kontakty}"
                       AutoGenerateColumns="False" RowDetailsVisibilityMode="VisibleWhenSelected" 
                       Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="9">
            <data:DataGrid.Columns>

                <data:DataGridTextColumn Header="Jméno" Binding="{Binding Jmeno}"/>
                <data:DataGridTextColumn Header="Přezdívka" Binding="{Binding Prezdivka}"/>
                <data:DataGridTextColumn Header="Příjmení" Binding="{Binding Prijmeni}"/>
                <data:DataGridTextColumn Header="E-mail" Binding="{Binding Email}"/>

            </data:DataGrid.Columns>

            <data:DataGrid.RowDetailsTemplate>
                <DataTemplate>
                    <Grid Background="White">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="30"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="60"/>
                            <ColumnDefinition Width="200"/>
                        </Grid.ColumnDefinitions>

                        <TextBlock Text="Adresa:" Grid.Column="0" Grid.Row="0"
                                   HorizontalAlignment="Left"/>
                        <TextBlock Text="{Binding Adresa}" Grid.Column="1" Grid.Row="0"
                                   HorizontalAlignment="Left"/>
                        <TextBlock Text="Činosti:" Grid.Column="0" Grid.Row="1"
                                   HorizontalAlignment="Left"/>

                        <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="1"
                                    HorizontalAlignment="Left" VerticalAlignment="Center">                            
                            <CheckBox Content="studuje" IsChecked="{Binding Studuje}" Margin="5,0,0,0"/>
                            <CheckBox Content="pracuje" IsChecked="{Binding Pracuje}" Margin="5,0,0,0"/>
                            <CheckBox Content="plave" IsChecked="{Binding Plave}" Margin="5,0,0,0"/>                            
                        </StackPanel>

                        <TextBlock Text="Narození:" Grid.Column="0" Grid.Row="2"
                                   HorizontalAlignment="Left"/>

                        <basics:DatePicker SelectedDate="{Binding Narozeni}" Grid.Column="1" Grid.Row="2"/>                        
                        <Button x:Name="tlacitko_smazat" Click="tlacitko_smazat_Click" Content="Smazat"
                                Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" Margin="1,1,1,6"/>
                    </Grid>
                </DataTemplate>
            </data:DataGrid.RowDetailsTemplate>
        </data:DataGrid>

    </Grid>
</UserControl>
