<Page
    x:Class="UWP_Sample.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:UWP_Sample"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:data="using:UWP_Sample.Models"
    mc:Ignorable="d"
    Background="#FF7E9CE4">

    <Page.Resources>
        <Style TargetType="Button">

            <Setter Property="UseSystemFocusVisuals" Value="True" />
            <Setter Property="Background" Value="{ThemeResource SystemControlBackgroundBaseLowBrush}" />
            <Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/>
            <Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundTransparentBrush}" />
            <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
            <Setter Property="FontWeight" Value="SemiBold" />
            <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
            <Setter Property="UseSystemFocusVisuals" Value="True" />

        </Style>
        <Style TargetType="PivotItem">
            <Setter Property="BorderThickness" Value="5" />
            <Setter Property="Background" Value="#FFD3DFEE"  ></Setter>
        </Style>
        <Style TargetType="TextBlock">
            <Setter Property="IsColorFontEnabled" Value="True"></Setter>
            <Setter Property="SelectionHighlightColor" Value="Blue"></Setter>
            
            
        </Style>
    </Page.Resources>

    
    <Pivot x:Name="rootPivot">

        <PivotItem Header="Create Table" Margin="20,20,20,20" >
            <StackPanel Margin="20,30,50,50">
                <AppBarButton Name="TableName" Label="Table" Click="Create_Button_Click" Background="#FFC1DCF9" Width="100" FontSize="40" ToolTipService.ToolTip="Creates Table 'UWP_Employees'" VerticalAlignment="Center" Margin="20,50,0,50">
                    <AppBarButton.Icon>
                        <SymbolIcon Symbol="Add" Foreground="Green" />
                    </AppBarButton.Icon>
                </AppBarButton>

                <TextBlock x:Name="CreateTable_Log" Height="295" Width="1600" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="20,50,0,100" TextAlignment="Left" TextWrapping="Wrap"></TextBlock>
            </StackPanel>
        </PivotItem>
        <PivotItem Header="Add Employees" Margin="20,10,20,20">
            <StackPanel Margin="20,0,0,0">
                <TextBox Name="EmpID" Header="ID" Width="150" HorizontalAlignment="Left" MaxLength="10" PlaceholderText="&lt;Enter EmpID&gt;" Margin="0,20,0,0"></TextBox>
                <TextBox Name="EmpName" Header="Employee Name" Width="300" HorizontalAlignment="Left" MaxLength="30"  PlaceholderText="&lt;Employee Name&gt;" Margin="0,20,0,0"></TextBox>
                <TextBox Name="EmpDesignation" Header="Designation" Width="300" HorizontalAlignment="Left" MaxLength="30" PlaceholderText="&lt;Employee Designation&gt;" Margin="0,20,0,0"></TextBox>
                <TextBox Name="EmpRole" Header="Role" Width="300" HorizontalAlignment="Left" MaxLength="20" PlaceholderText="&lt;Employee Role&gt;" Margin="0,20,0,0"></TextBox>
                <TextBox Name="EmpSalary" Header="Salary" Width="150" HorizontalAlignment="Left" MaxLength="20" PlaceholderText="&lt;Salary in digits&gt;"  Margin="0,20,0,0"></TextBox>
                <Button Content="Add Employee" Width="150" Height="50" Click="AddEmp_Button_Click" Margin="0,20,50,0" VerticalAlignment="Bottom" HorizontalAlignment="Left" ></Button>
                <TextBlock x:Name="AddEmployee_Log" Height="150" Width="1200" VerticalAlignment="Bottom" HorizontalAlignment="Left"  TextAlignment="Left" TextWrapping="Wrap" ></TextBlock>
            </StackPanel>
        </PivotItem>
        <PivotItem Header="Get Employees" Margin="20,20,20,20">
            <Grid Margin="20" >
                <Grid.RowDefinitions >
                    <RowDefinition Height="Auto"  />
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="150"/>
                    <RowDefinition Height="180"/>
                </Grid.RowDefinitions>

                <ListView ItemsSource="{x:Bind Employees}" Grid.Row="1">
                    <ListView.HeaderTemplate>
                        <DataTemplate>
                            <Grid Padding="12" Background="{ThemeResource AppBarItemDisabledForegroundThemeBrush}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="80"/>
                                    <ColumnDefinition Width="300"/>
                                    <ColumnDefinition Width="300"/>
                                    <ColumnDefinition Width="300"/>
                                    <ColumnDefinition Width="200"/>
                                </Grid.ColumnDefinitions>
                                <TextBlock Text="EmpID" Style="{ThemeResource CaptionTextBlockStyle}" FontWeight="SemiBold" />
                                <TextBlock Grid.Column="1" Text="Emp Name" Style="{ThemeResource CaptionTextBlockStyle}" FontWeight="SemiBold"/>
                                <TextBlock Grid.Column="2" Text="Designation" Style="{ThemeResource CaptionTextBlockStyle}" FontWeight="SemiBold"/>
                                <TextBlock Grid.Column="3" Text="Role" Style="{ThemeResource CaptionTextBlockStyle}" FontWeight="SemiBold"/>
                                <TextBlock Grid.Column="4" Text="Salary" Style="{ThemeResource CaptionTextBlockStyle}" FontWeight="SemiBold"/>
                            </Grid>
                        </DataTemplate>
                    </ListView.HeaderTemplate>
                    <ListView.ItemTemplate>
                        <DataTemplate x:DataType="data:Employee">
                            <Grid Height="48" AutomationProperties.Name="{x:Bind EmpID}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="80"/>
                                    <ColumnDefinition Width="300"/>
                                    <ColumnDefinition Width="300"/>
                                    <ColumnDefinition Width="300"/>
                                    <ColumnDefinition Width="200"/>
                                </Grid.ColumnDefinitions>
                                <TextBlock Grid.Column="0" Text="{x:Bind EmpID}"  FontSize="16"></TextBlock>
                                <TextBlock Grid.Column="1" Text="{x:Bind EmpName}"  FontSize="16"></TextBlock>
                                <TextBlock Grid.Column="2" Text="{x:Bind Designation}"  FontSize="16"></TextBlock>
                                <TextBlock Grid.Column="3" Text="{x:Bind Role}"  FontSize="16"></TextBlock>
                                <TextBlock Grid.Column="4" Text="{x:Bind Sal}"  FontSize="16"></TextBlock>
                            </Grid>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
                <StackPanel Grid.Row="3" >
                    <Button Content="Get All Employees" Click="GetEmp_Button_Click"  Height="50" Width="150" HorizontalAlignment="Left"/>
                    <TextBlock Name="GetEmployee_Log" Height="80" Width="1000" HorizontalAlignment="Left"  TextAlignment="Left" TextWrapping="Wrap" VerticalAlignment="Bottom" Margin="0,20,0,0"></TextBlock>
                </StackPanel>
            </Grid>
        </PivotItem>

        <PivotItem Header="Update Employee" Margin="20,10,20,20" >
            <StackPanel Margin="20,10,20,20">
                <TextBox Name="UpdateEmpID" Header="ID" Width="190" HorizontalAlignment="Left" MaxLength="10" PlaceholderText="&lt;EmpID to be Updated&gt;" Margin="0,10,0,0"></TextBox>
                <TextBox Name="UpdateEmpName" Header="Employee Name" Width="300" HorizontalAlignment="Left" MaxLength="30"  PlaceholderText="&lt;Employee Name&gt;" Margin="0,20,0,0"></TextBox>
                <TextBox Name="UpdateEmpDesignation" Header="Designation" Width="300" HorizontalAlignment="Left" MaxLength="30" PlaceholderText="&lt;Employee Designation&gt;" Margin="0,20,0,0"></TextBox>
                <TextBox Name="UpdateEmpRole" Header="Role" Width="300" HorizontalAlignment="Left" MaxLength="20" PlaceholderText="&lt;Employee Role&gt;" Margin="0,20,0,0"></TextBox>
                <TextBox Name="UpdateEmpSalary" Header="Salary" Width="150" HorizontalAlignment="Left" MaxLength="20" PlaceholderText="&lt;Salary in digits&gt;"  Margin="0,20,0,0"></TextBox>
                <Button Content="Update Employee" Width="150" Height="50" Click="UpdateEmp_Button_Click" Margin="0,20,20,0" VerticalAlignment="Bottom" HorizontalAlignment="Left" ></Button>
                <TextBlock x:Name="UpdateEmployee_Log" ScrollViewer.VerticalScrollMode="Enabled" Height="300" Width="1300" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="0,50,0,50" TextAlignment="Left" TextWrapping="Wrap" ></TextBlock>
            </StackPanel>
        </PivotItem>
        <PivotItem Header="Delete Employee" Margin="20,20,20,20" >
            <StackPanel Margin="20,30,50,50">
                <TextBox Name="DelEmpID" Header="ID" Width="200"  HorizontalAlignment="Left" MaxLength="10" PlaceholderText="&lt;EmpID to be Updated&gt;" Margin="0,20,0,0"></TextBox>
                <Button Content="Delete Employee" Width="150" Height="50" Click="DelEmp_Button_Click"  VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="0,50,50,0"></Button>
                <TextBlock x:Name="DelEmployee_Log" Height="300" Width="1000" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="0,50,0,50" TextAlignment="Left" TextWrapping="Wrap" ></TextBlock>
            </StackPanel>
        </PivotItem>
        <PivotItem Header="Drop Table" Margin="20,20,20,20" >
            <StackPanel Margin="20,30,50,50">

                <AppBarButton Name="DropTableName" Label="Drop Table" Click="Drop_Button_Click" Background="#FFC1DCF9" Width="100" FontSize="40" ToolTipService.ToolTip="Drops the Table 'UWP_Employees'" VerticalAlignment="Center" Margin="20,50,0,50">
                    <AppBarButton.Icon>
                        <SymbolIcon Symbol="Remove" Foreground="Red" />
                    </AppBarButton.Icon>
                </AppBarButton>
                <TextBlock x:Name="DropTable_Log" Height="300" Width="1800" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="0,50,0,50" TextAlignment="Left" TextWrapping="Wrap" ></TextBlock>

            </StackPanel>
        </PivotItem>
    </Pivot>


</Page>
