<?xml version="1.0" encoding="utf-8"?>
    <Window 
        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"
        xmlns:local="clr-namespace:GridLine"
        mc:Ignorable="d"
        Title="Add Data Grid Line" FontFamily="Trebuchet MS" Background="#E5E5E5" Height="450" Width="710" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
        <!-- Title="Add Data Grid Line" FontFamily="Trebuchet MS" Background="#EBEAE8" Height="450" Width="710" ResizeMode="NoResize" WindowStartupLocation="CenterScreen"> -->
    <Grid>
        <DataGrid x:Name="DataGridHorizontal" VirtualizingStackPanel.IsVirtualizing ="False" VirtualizingStackPanel.VirtualizationMode ="Recycling"
                    HorizontalAlignment="Left" Height="130" Margin="410,25,0,0" VerticalAlignment="Top" Width="250"
                     IsReadOnly="False" AutoGenerateColumns="False" ScrollViewer.CanContentScroll="True"
                     SelectionChanged="DataGridHorizontal_SelectionChanged" >
            <DataGrid.Resources>
                <Style TargetType="{x:Type DataGridColumnHeader}">
                    <Setter Property="Background" Value="#03855C"/>
                    <Setter Property="Foreground" Value="White"/>
                    <!-- <Setter Property="Background" Value="#00fff9"/> -->
                    <Setter Property="FontWeight" Value="SemiBold"/>
                    <Setter Property="BorderThickness" Value="0,0,1,2"/>
                    <!-- <Setter Property="BorderBrush" Value="White"/> -->
                    <Setter Property="BorderBrush" Value="Black"/>
                    <Setter Property="HorizontalContentAlignment" Value="Center"/>
                    <Setter Property="VerticalContentAlignment" Value="Center"/>
                    <Setter Property="Height" Value="30"/>
                </Style>
            </DataGrid.Resources>
            <DataGrid.Columns>
                <DataGridTextColumn Header="Grid line Name" Binding="{Binding hgname}" Width="100" FontSize="14"/>
                <DataGridTextColumn Header="Grid Spacing (mm.)" Binding="{Binding hgspacing}" Width="*" FontSize="14"/>

            </DataGrid.Columns>
        </DataGrid>
        <TextBox x:Name="HGNameTB" Text="A"  FontFamily="Trebuchet MS" FontSize="14" HorizontalAlignment="Left" Height="25" Margin="310,25,0,0" VerticalContentAlignment="Center" TextAlignment="Center" TextWrapping="Wrap"
                    VerticalAlignment="Top" Width="50" RenderTransformOrigin="1.591,0.077"/>
        <TextBox x:Name="HGSpacingTB" Text="0" FontFamily="Trebuchet MS" FontSize="14"  HorizontalAlignment="Left" Height="25" Margin="310,65,0,0" VerticalContentAlignment="Center" TextAlignment="Right" TextWrapping="Wrap"
                    VerticalAlignment="Top" Width="50" RenderTransformOrigin="1.591,0.077"/>
        <Label Content="Horizontal Gridline Name" HorizontalAlignment="Left" Margin="20,25,0,0" VerticalAlignment="Top"/>
        <Label Content="(such as : A or 1 or ก,B-F or 2-6 except A1-H or ก-ฮ)" HorizontalAlignment="Left" Margin="15,40,0,0" VerticalAlignment="Top"/>
        <Label Content="Horizontal Gridline Spacing (Start value = 0)" HorizontalAlignment="Left" Margin="20,65,0,0" VerticalAlignment="Top"/>
        <Label Content="(mm.)" HorizontalAlignment="Left" Margin="360,65,0,0" VerticalAlignment="Top"/>
        <Button x:Name="addHgBtn" Content="Add Data" Background="#eec1ad" HorizontalAlignment="Left" Height="25" Margin="320,110,0,0" VerticalAlignment="Top" Width="75" Click = "addHgBtn" />
        <Button x:Name="InHgBtn" Content="Insert Data" HorizontalAlignment="Left" Height="25" Margin="140,110,0,0" VerticalAlignment="Top" Width="75" Click = "InHgBtn" />
        <Button x:Name="MoHgBtn" Content="Modify Data" HorizontalAlignment="Left" Height="25" Margin="230,110,0,0" VerticalAlignment="Top" Width="75" IsEnabled="True"  Click = "MoHgBtn"/>
        <Button x:Name="DelHgBtn" Content="Delete All Data" HorizontalAlignment="Left" Height="25" Margin="25,110,0,0" VerticalAlignment="Top" Width="100" Click = "DelHgBtn"/>
        <Button x:Name="DelRowHgBtn" Content="Delete Row Data" HorizontalAlignment="Left" Height="25" Margin="25,150,0,0" VerticalAlignment="Top" Width="100" Click = "DelRowHgBtn"/>
        <RadioButton Content="Gridline Start at UP" GroupName = "HGL" Name="upHgRadioBtn" HorizontalAlignment="Left" Margin="140,150,0,0" VerticalAlignment="Top" Checked="HgRadioBtn"/>
        <RadioButton Content="Gridline Start at DOWN" GroupName = "HGL" Name="downHgRadioBtn" HorizontalAlignment="Left" Margin="140,170,0,0" VerticalAlignment="Top" Checked="HgRadioBtn"/>

        <DataGrid x:Name="DataGridVertical" VirtualizingStackPanel.IsVirtualizing ="False" VirtualizingStackPanel.VirtualizationMode ="Recycling"
                    HorizontalAlignment="Left" Height="130" Margin="410,190,0,0" VerticalAlignment="Top" Width="250"
                    IsReadOnly="False" AutoGenerateColumns="False" ScrollViewer.CanContentScroll="True"
                    SelectionChanged="DataGridVertical_SelectionChanged">
            <DataGrid.Resources>
                <Style TargetType="{x:Type DataGridColumnHeader}">
                    <Setter Property="Background" Value="#03855C"/>
                    <Setter Property="Foreground" Value="White"/>
                    <Setter Property="FontWeight" Value="SemiBold"/>
                    <Setter Property="BorderThickness" Value="0,0,1,2"/>
                    <Setter Property="BorderBrush" Value="Black"/>
                    <Setter Property="HorizontalContentAlignment" Value="Center"/>
                    <Setter Property="VerticalContentAlignment" Value="Center"/>
                    <Setter Property="Height" Value="30"/>
                </Style>
            </DataGrid.Resources>
            <DataGrid.Columns>
                <DataGridTextColumn Header="Grid line Name" Binding="{Binding vgname,UpdateSourceTrigger=LostFocus}" Width="100" FontSize="14"/>
                <DataGridTextColumn Header="Grid Spacing (mm.)" Binding="{Binding vgspacing,UpdateSourceTrigger=LostFocus}" Width="*" FontSize="14"/>

            </DataGrid.Columns>
        </DataGrid>
        <TextBox x:Name="VGNameTB" Text="1" FontFamily="Trebuchet MS" FontSize="14"  HorizontalAlignment="Left" Height="25" Margin="310,200,0,0" VerticalContentAlignment="Center" TextAlignment="Center" TextWrapping="Wrap"
                    VerticalAlignment="Top" Width="50" RenderTransformOrigin="1.591,0.077"/>
        <TextBox x:Name="VGSpacingTB" Text="0" FontFamily="Trebuchet MS" FontSize="14"  HorizontalAlignment="Left" Height="25" Margin="310,240,0,0" VerticalContentAlignment="Center" TextAlignment="Right"  TextWrapping="Wrap"
                    VerticalAlignment="Top" Width="50" RenderTransformOrigin="1.591,0.077"/>
        <Label Content="Vertital Gridline Name" HorizontalAlignment="Left" Margin="20,200,0,0" VerticalAlignment="Top"/>
        <Label Content="(such as : A or 1 or ก,B-F or 2-6 except A1-H or ก-ฮ)" HorizontalAlignment="Left" Margin="15,215,0,0" VerticalAlignment="Top"/>
        <Label Content="Vertital Gridline Spacing (Start value = 0)" HorizontalAlignment="Left" Margin="20,240,0,0" VerticalAlignment="Top"/>
        <Label Content="(mm.)" HorizontalAlignment="Left" Margin="360,240,0,0" VerticalAlignment="Top"/>
        <Button x:Name="addVgBtn" Content="Add Data" Background="#eec1ad" HorizontalAlignment="Left" Height="25" Margin="320,290,0,0" VerticalAlignment="Top" Width="75" Click = "addVgBtn" />
        <Button x:Name="InVgBtn" Content="Insert Data" HorizontalAlignment="Left" Height="25" Margin="140,290,0,0" VerticalAlignment="Top" Width="75" Click = "InVgBtn"/>
        <Button x:Name="MoVgBtn" Content="Modify Data" HorizontalAlignment="Left" Height="25" Margin="230,290,0,0" VerticalAlignment="Top" Width="75" Click = "MoVgBtn"/>
        <Button x:Name="DelVgBtn" Content="Delete All Data" HorizontalAlignment="Left" Height="25" Margin="25,290,0,0" VerticalAlignment="Top" Width="100" Click = "DelVgBtn"/>
        <Button x:Name="DelRowVgBtn" Content="Delete Row Data" HorizontalAlignment="Left" Height="25" Margin="25,330,0,0" VerticalAlignment="Top" Width="100" Click = "DelRowVgBtn"/>
        <RadioButton Content="Gridline Start at LIFT" GroupName = "VGL" Name="liftVgRadioBtn" HorizontalAlignment="Left" Margin="140,340,0,0" VerticalAlignment="Top" Checked="VgRadioBtn"/>
        <RadioButton Content="Gridline Start at RIGHT" GroupName = "VGL" Name="rightVgRadioBtn" HorizontalAlignment="Left" Margin="140,360,0,0" VerticalAlignment="Top" Checked="VgRadioBtn"/>
        <Button x:Name="CrBtn" Content="Create Gridline" Background="#FF8DC6" Foreground = "White" HorizontalAlignment="Left" Height="30" Margin="350,340,0,0" VerticalAlignment="Top" Width="100" Click = "CrBtn"/>
        <Button x:Name="ExBtn" Content="Exit" Background="#F85F29" Foreground = "White" HorizontalAlignment="Left" Height="30" Margin="480,340,0,0" VerticalAlignment="Top" Width="60" Click = "ExBtn"/>


    </Grid>
</Window>
