<Window x:Class="ScreenToGif.Windows.Other.RegionSelection"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:t="clr-namespace:ScreenToGif.Settings"
        x:Name="ThisWindow" Title="ScreenToGif" WindowStyle="None" AllowsTransparency="True" Topmost="True" ResizeMode="NoResize" SizeToContent="WidthAndHeight"
        UseLayoutRounding="True" SnapsToDevicePixels="True" Background="{x:Null}" ShowInTaskbar="False"
        DpiChanged="Window_DpiChanged">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        
        <Rectangle Grid.Row="1" Grid.Column="1" x:Name="SelectionRectangle" StrokeDashArray="5" Stroke="#FFABABAB" StrokeThickness="1" IsHitTestVisible="False" Effect="{x:Null}"/>

        <!--<TextBlock Grid.Row="1" Grid.Column="1" Background="Beige" Margin="5" VerticalAlignment="Top" HorizontalAlignment="Left">
            <Run Text="{Binding ElementName=ThisWindow, Path=Left, StringFormat={}{0}}"/>
            <Run Text="x"/>
            <Run Text="{Binding ElementName=ThisWindow, Path=Top, StringFormat={}{0}}"/>
        </TextBlock>-->
        
        <Grid Grid.Row="1" Grid.Column="1" x:Name="GuidelinesGrid">
            <Grid Visibility="{Binding Source={x:Static t:UserSettings.All}, Path=DisplayThirdsGuideline, Converter={StaticResource Bool2Visibility}}">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>

                <!--Rule of thirds, horizontal top-->
                <Line Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" x:Name="ThirdsLine" X1="0" Y1="0" X2="1" Y2="0" 
                      Stroke="{Binding Source={x:Static t:UserSettings.All}, Path=ThirdsGuidelineColor, Converter={StaticResource ColorToBrush}}" 
                      StrokeThickness="{Binding Source={x:Static t:UserSettings.All}, Path=ThirdsGuidelineThickness}" Stretch="Uniform" VerticalAlignment="Bottom"
                      StrokeDashArray="{Binding Source={x:Static t:UserSettings.All}, Path=ThirdsGuidelineStrokeDashArray}"/>

                <!--Rule of thirds, horizontal bottom-->
                <Line Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" X1="0" Y1="0" X2="1" Y2="0" Stroke="{Binding ElementName=ThirdsLine, Path=Stroke}" 
                      StrokeThickness="{Binding ElementName=ThirdsLine, Path=StrokeThickness}" Stretch="Uniform" VerticalAlignment="Top"
                      StrokeDashArray="{Binding ElementName=ThirdsLine, Path=StrokeDashArray}"/>

                <!--Rule of thirds, vertical left-->
                <Line Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" X1="0" Y1="0" X2="0" Y2="1" Stroke="{Binding ElementName=ThirdsLine, Path=Stroke}" 
                      StrokeThickness="{Binding ElementName=ThirdsLine, Path=StrokeThickness}" Stretch="Uniform" HorizontalAlignment="Right"
                      StrokeDashArray="{Binding ElementName=ThirdsLine, Path=StrokeDashArray}"/>

                <!--Rule of thirds, vertical right-->
                <Line Grid.Row="0" Grid.Column="2" Grid.RowSpan="3" X1="0" Y1="0" X2="0" Y2="1" Stroke="{Binding ElementName=ThirdsLine, Path=Stroke}" 
                      StrokeThickness="{Binding ElementName=ThirdsLine, Path=StrokeThickness}" Stretch="Uniform" HorizontalAlignment="Left"
                      StrokeDashArray="{Binding ElementName=ThirdsLine, Path=StrokeDashArray}"/>
            </Grid>

            <Grid Visibility="{Binding Source={x:Static t:UserSettings.All}, Path=DisplayCrosshairGuideline, Converter={StaticResource Bool2Visibility}}">
                <!--Crosshair, horizontal-->
                <Line X1="0" Y1="0" X2="1" Y2="0" x:Name="CrosshairLine" Stroke="{Binding Source={x:Static t:UserSettings.All}, Path=CrosshairGuidelineColor, Converter={StaticResource ColorToBrush}}" 
                      StrokeThickness="{Binding Source={x:Static t:UserSettings.All}, Path=CrosshairGuidelineThickness}" Stretch="Uniform" VerticalAlignment="Center" 
                      StrokeDashArray="{Binding Source={x:Static t:UserSettings.All}, Path=CrosshairGuidelineStrokeDashArray}"/>

                <!--Crosshair, vertical-->
                <Line X1="0" Y1="0" X2="0" Y2="1" Stroke="{Binding ElementName=CrosshairLine, Path=Stroke}" StrokeThickness="{Binding ElementName=CrosshairLine, Path=StrokeThickness}" 
                      Stretch="Uniform" HorizontalAlignment="Center" StrokeDashArray="{Binding ElementName=CrosshairLine, Path=StrokeDashArray}"/>
            </Grid>
        </Grid>

        <!--Thumbs-->
        <Border Grid.Row="1" Grid.Column="2" x:Name="HorizontalBorder" Width="10" Height="30" BorderThickness="0,1,1,0" Background="{DynamicResource Panel.Background.Level2}" 
                BorderBrush="{DynamicResource Element.Border}" CornerRadius="0,15,0,0" VerticalAlignment="Bottom" HorizontalAlignment="Left" Cursor="SizeAll" 
                Visibility="Collapsed" ToolTip="{DynamicResource S.Recorder.Move}" ToolTipService.Placement="Right"
                MouseLeftButtonDown="Thumb_MouseLeftButtonDown" MouseMove="Thumb_MouseMove" PreviewMouseLeftButtonUp="Thumb_PreviewMouseLeftButtonUp"/>

        <Border Grid.Row="2" Grid.Column="2" x:Name="CornerBorder" Width="10" Height="10" BorderThickness="0,0,1,1" Background="{DynamicResource Panel.Background.Level2}" 
                BorderBrush="{DynamicResource Element.Border}" CornerRadius="0,0,15,0" VerticalAlignment="Top" HorizontalAlignment="Left" Cursor="SizeAll" 
                Visibility="Collapsed" ToolTip="{DynamicResource S.Recorder.Move}" ToolTipService.Placement="Right"
                MouseLeftButtonDown="Thumb_MouseLeftButtonDown" MouseMove="Thumb_MouseMove" PreviewMouseLeftButtonUp="Thumb_PreviewMouseLeftButtonUp"/>

        <Border Grid.Row="2" Grid.Column="1" x:Name="VerticalBorder" Width="30" Height="10" BorderThickness="1,0,0,1" Background="{DynamicResource Panel.Background.Level2}" 
                BorderBrush="{DynamicResource Element.Border}" CornerRadius="0,0,0,15" VerticalAlignment="Top" HorizontalAlignment="Right" Cursor="SizeAll" 
                Visibility="Collapsed" ToolTip="{DynamicResource S.Recorder.Move}" ToolTipService.Placement="Bottom"
                MouseLeftButtonDown="Thumb_MouseLeftButtonDown" MouseMove="Thumb_MouseMove" PreviewMouseLeftButtonUp="Thumb_PreviewMouseLeftButtonUp"/>
    </Grid>
</Window>