<n:LightWindow x:Name="RecorderLightWindow" x:Class="ScreenToGif.Windows.Recorder"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               xmlns:n="clr-namespace:ScreenToGif.Controls"
               xmlns:u="clr-namespace:ScreenToGif.Util"
               xmlns:c="clr-namespace:ScreenToGif.Util.Converters"
               xmlns:t="clr-namespace:ScreenToGif.Settings"
               Title="ScreenToGif" SnapsToDevicePixels="True" UseLayoutRounding="True" AllowsTransparency="True" WindowStyle="None" 
               Topmost="True" Icon="../Resources/Logo.ico"
               IsThin="{Binding RecorderThinMode, Source={x:Static t:UserSettings.All}}"
               IsFollowing="{Binding CursorFollowing, Source={x:Static t:UserSettings.All}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
               FocusManager.FocusedElement="{Binding RelativeSource={x:Static RelativeSource.Self}, Mode=OneTime}"
               Loaded="Window_Loaded" Closing="Window_Closing" Activated="Window_Activated" KeyDown="Window_KeyDown">

    <Window.Resources>
        <Storyboard x:Key="ShowDiscardStoryboard">
            <BooleanAnimationUsingKeyFrames Storyboard.TargetName="DiscardButton" Storyboard.TargetProperty="IsHitTestVisible" Duration="0:0:0" >
                <DiscreteBooleanKeyFrame Value="True" KeyTime="0:0:0"/>
            </BooleanAnimationUsingKeyFrames>

            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DiscardButton" Storyboard.TargetProperty="Visibility" Duration="0:0:0">
                <DiscreteObjectKeyFrame Value="{x:Static Visibility.Visible}" KeyTime="0:0:0"/>
            </ObjectAnimationUsingKeyFrames>

            <DoubleAnimation Storyboard.TargetName="DiscardButton" Storyboard.TargetProperty="(Button.Opacity)" From="0" To="1" Duration="0:0:1">
                <DoubleAnimation.EasingFunction>
                    <PowerEase Power="8" />
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
        </Storyboard>

        <Storyboard x:Key="HideDiscardStoryboard">
            <BooleanAnimationUsingKeyFrames Storyboard.TargetName="DiscardButton" Storyboard.TargetProperty="IsHitTestVisible" Duration="0:0:0" >
                <DiscreteBooleanKeyFrame Value="False" KeyTime="0:0:0"/>
            </BooleanAnimationUsingKeyFrames>

            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DiscardButton" Storyboard.TargetProperty="Visibility" Duration="0:0:0">
                <DiscreteObjectKeyFrame Value="{x:Static Visibility.Collapsed}" KeyTime="0:0:0"/>
            </ObjectAnimationUsingKeyFrames>

            <DoubleAnimation Storyboard.TargetName="DiscardButton" Storyboard.TargetProperty="(Button.Opacity)" 
                             From="{Binding ElementName=DiscardButton,Path=Opacity}" To="0" Duration="0:0:1">
                <DoubleAnimation.EasingFunction>
                    <PowerEase Power="8" />
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
        </Storyboard>

        <Storyboard x:Key="HideWindowStoryboard" FillBehavior="Stop" DesiredFrameRate="60" SpeedRatio="2">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="RecorderLightWindow" Storyboard.TargetProperty="(Window.Opacity)" Duration="0:0:0.1" FillBehavior="Stop">
                <DiscreteDoubleKeyFrame Value="0" KeyTime="0:0:0"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>

        <Storyboard x:Key="ShowWindowStoryboard" FillBehavior="Stop" DesiredFrameRate="60">
            <DoubleAnimation Storyboard.TargetName="RecorderLightWindow" Storyboard.TargetProperty="(Window.Opacity)" 
                             From="{Binding ElementName=DashedRectangle,Path=Opacity}" To="1" Duration="0:0:1" FillBehavior="Stop">
                <DoubleAnimation.EasingFunction>
                    <PowerEase Power="8"/>
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
        </Storyboard>

        <c:KeyGestureToString x:Key="KeyGestureToString"/>
        <c:InvertedBoolToVisibility x:Key="InvertedBoolToVisibility"/>
        <c:IntToString x:Key="IntToStringConverter"/>
        <c:BoolOr x:Key="BoolOr"/>
    </Window.Resources>

    <Window.TaskbarItemInfo>
        <TaskbarItemInfo>
            <TaskbarItemInfo.ThumbButtonInfos>
                <ThumbButtonInfoCollection>
                    <ThumbButtonInfo x:Name="RecordThumbInfo" Command="{Binding RecordCommand}" DismissWhenClicked="True" 
                                     Description="{DynamicResource S.Recorder.Record}" CommandTarget="{Binding ElementName=RecordButton}"
                                     Visibility="{Binding ElementName=RecordButton, Path=Visibility, Mode=OneWay}">
                        <ThumbButtonInfo.ImageSource>
                            <DrawingImage Drawing="{Binding Source={StaticResource Vector.Record}, Path=Drawing, Mode=OneTime}"/>
                        </ThumbButtonInfo.ImageSource>
                    </ThumbButtonInfo>

                    <ThumbButtonInfo x:Name="SnapThumbInfo" Command="{Binding SnapCommand}" DismissWhenClicked="True" 
                                     Description="{DynamicResource S.Recorder.Snap}" CommandTarget="{Binding ElementName=SnapButton}"
                                     Visibility="{Binding ElementName=SnapButton, Path=Visibility, Mode=OneWay}">
                        <ThumbButtonInfo.ImageSource>
                            <DrawingImage Drawing="{Binding Source={StaticResource Vector.Camera.Add}, Path=Drawing, Mode=OneTime}"/>
                        </ThumbButtonInfo.ImageSource>
                    </ThumbButtonInfo>

                    <ThumbButtonInfo x:Name="PauseThumbInfo" Command="{Binding PauseCommand}" DismissWhenClicked="True" 
                                     Description="{DynamicResource S.Recorder.Pause}" CommandTarget="{Binding ElementName=PauseButton}"
                                     Visibility="{Binding ElementName=PauseButton, Path=Visibility, Mode=OneWay}">
                        <ThumbButtonInfo.ImageSource>
                            <DrawingImage Drawing="{Binding Source={StaticResource Vector.Pause}, Path=Drawing, Mode=OneTime}"/>
                        </ThumbButtonInfo.ImageSource>
                    </ThumbButtonInfo>
                    
                    <ThumbButtonInfo x:Name="StopThumbInfo" Command="{Binding StopCommand}" DismissWhenClicked="True" 
                                     Description="{DynamicResource S.Recorder.Stop}" CommandTarget="{Binding ElementName=StopButton}">
                        <ThumbButtonInfo.ImageSource>
                            <DrawingImage Drawing="{Binding Source={StaticResource Vector.Stop}, Path=Drawing, Mode=OneTime}"/>
                        </ThumbButtonInfo.ImageSource>
                    </ThumbButtonInfo>
                    
                    <ThumbButtonInfo Visibility="Hidden"/>

                    <ThumbButtonInfo x:Name="DiscardThumbInfo" Command="{Binding DiscardCommand}" DismissWhenClicked="True" 
                                     Description="{DynamicResource S.Recorder.Discard}" CommandTarget="{Binding ElementName=DiscardButton}">
                        <ThumbButtonInfo.ImageSource>
                            <DrawingImage Drawing="{Binding Source={StaticResource Vector.Remove}, Path=Drawing, Mode=OneTime}"/>
                        </ThumbButtonInfo.ImageSource>
                    </ThumbButtonInfo>
                </ThumbButtonInfoCollection>
            </TaskbarItemInfo.ThumbButtonInfos>
        </TaskbarItemInfo>
    </Window.TaskbarItemInfo>

    <Grid x:Name="OutterGrid" UseLayoutRounding="True">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="31"/>
        </Grid.RowDefinitions>
        
        <!--Hollow part-->
        <Border BorderBrush="{Binding ElementName=RecorderLightWindow, Path=BorderBrush}" BorderThickness="{Binding ElementName=RecorderLightWindow, Path=BorderThickness}">
            <Grid 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>
        </Border>

        <!--Command bar-->
        <Grid Grid.Row="1" x:Name="LowerGrid" Height="31" VerticalAlignment="Bottom" Background="{Binding ElementName=RecorderLightWindow, Path=Background}" 
              KeyboardNavigation.TabNavigation="Cycle" MouseLeftButtonDown="CommandGrid_MouseLeftButtonDown">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>

            <Grid Grid.Column="0" Visibility="{Binding RecorderThinMode, Source={x:Static t:UserSettings.All}, Converter={StaticResource Bool2Visibility}}">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>

                <n:ExtendedButton Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" x:Name="CloseButton" Icon="{StaticResource Vector.Close}" Style="{StaticResource Style.Button.NoText}"
                                  ContentHeight="10" ContentWidth="10" Padding="4,1" TabIndex="1" Click="CloseButton_Click"/>

                <TextBlock Grid.Row="0" Grid.Column="1" x:Name="CaptionText" Text="{Binding Title, ElementName=RecorderLightWindow}" FontFamily="Segoe UI" FontSize="12"
                           FontWeight="Regular" Margin="5,0,0,0" Foreground="{DynamicResource Element.Foreground}"/>

                <TextBlock Grid.Row="1" Grid.Column="1" x:Name="FrameCountTextBlock" Text="{Binding FrameCount, ElementName=RecorderLightWindow, Converter={StaticResource IntToStringConverter}}" 
                           FontFamily="Segoe UI" FontSize="12" FontWeight="Regular" Margin="5,0,0,0" Foreground="{DynamicResource Element.Foreground.Header}"/>
            </Grid>

            <!--Command controls-->
            <StackPanel Grid.Column="1" x:Name="ControlStackPanel" Height="31" Orientation="Horizontal" HorizontalAlignment="Right"
                        ScrollViewer.VerticalScrollBarVisibility="Disabled">

                <Grid Background="{StaticResource Vector.Cursor}" Margin="5,4" ToolTip="{DynamicResource S.Recorder.CursorFollowing}" Width="16"
                      Visibility="{Binding ElementName=RecorderLightWindow, Path=IsFollowing, Converter={StaticResource Bool2Visibility}, FallbackValue={x:Static Visibility.Collapsed}}"/>

                <n:ExtendedButton x:Name="SnapWindowButton" Icon="{StaticResource Vector.Crosshair}" Margin="0" Style="{StaticResource Style.Button.NoText}" 
                                  HorizontalContentAlignment="Center" ContentHeight="20" ContentWidth="20" Command="{Binding SnapToWindowCommand}" Padding="3" TabIndex="2" 
                                  ToolTipService.HorizontalOffset="-5" ToolTipService.Placement="Bottom" ToolTip="{DynamicResource S.Recorder.SnapToWindow}" 
                                  PreviewMouseDown="SnapWindowButton_PreviewMouseDown"/>

                <n:ExtendedButton x:Name="OptionsButton" Icon="{DynamicResource Vector.Options}" Margin="0" Padding="3" 
                                  Style="{DynamicResource Style.Button.NoText}" ContentHeight="20" ContentWidth="20" Command="{Binding OptionsCommand}" TabIndex="0"
                                  ToolTipService.HorizontalOffset="-5" ToolTipService.Placement="Bottom" ToolTip="{DynamicResource S.StartUp.Options}"/>
                
                <Separator Width="1" Margin="5,2"/>

                <Viewbox x:Name="FrequencyViewbox" Stretch="UniformToFill" ClipToBounds="True" Focusable="False" 
                         ToolTip="{DynamicResource S.Recorder.Fps.Range}" ToolTipService.Placement="Bottom" ToolTipService.HorizontalOffset="-5">
                    <Grid HorizontalAlignment="Center" VerticalAlignment="Center" FlowDirection="LeftToRight" Margin="-4" Opacity="{DynamicResource Element.Opacity}"
                          Visibility="{Binding Path=RecorderThinMode, Source={x:Static t:UserSettings.All}, Converter={StaticResource InvertedBoolToVisibility}}">
                        <n:CircularProgressBar StrokeThickness="2" Percentage="100" SegmentColor="Gray" Radius="24" IsTabStop="False"/>
                        <n:CircularProgressBar StrokeThickness="22" Percentage="100" SegmentColor="#FFF0F1F1" Radius="10" IsTabStop="False"/>

                        <n:CircularProgressBar StrokeThickness="2" Value="{Binding ElementName=FrequencyIntegerUpDown, Path=Value, Mode=OneWay}" 
                                               IsInverted="True" Minimum="1" Maximum="60" SegmentColor="#FFE28A73" Radius="24" IsTabStop="False"/>
                        <n:CircularProgressBar StrokeThickness="22" Value="{Binding ElementName=FrequencyIntegerUpDown, Path=Value, Mode=OneWay}" 
                                               IsInverted="True" Minimum="1" Maximum="60" SegmentColor="#FFE28A73" Radius="10" IsTabStop="False"/>
                    </Grid>
                </Viewbox>

                <n:IntegerUpDown x:Name="FrequencyIntegerUpDown" Margin="1,3" StepValue="1" Minimum="1" Maximum="60" MinWidth="45" TabIndex="4"
                                 Value="{Binding Source={x:Static t:UserSettings.All}, Path=LatestFps, Mode=TwoWay}"
                                 ToolTip="{DynamicResource S.Recorder.Fps}" ToolTipService.Placement="Bottom" ToolTipService.HorizontalOffset="-5"/>

                <n:ExtendedButton x:Name="FrequencyButton" Style="{StaticResource Style.Button.Horizontal.NoImage}" Margin="1,0,0,0" VerticalContentAlignment="Center" Padding="0" 
                                  UseLayoutRounding="True" TabIndex="5" Text="{DynamicResource S.Recorder.Fps.Short}" FontSize="12" TextWrapping="NoWrap"
                                  ToolTip="{DynamicResource S.Recorder.SwitchFrequency}" ToolTipService.Placement="Bottom" ToolTipService.HorizontalOffset="-5"
                                  Command="{Binding SwitchFrequencyCommand}" CommandParameter="Switch">
                    <n:ExtendedButton.ContextMenu>
                        <ContextMenu IsOpen="False">
                            <n:ExtendedMenuItem Header="{DynamicResource S.Options.Recorder.Frequency}" IsHitTestVisible="False" Icon="{StaticResource Vector.Record}" ContentHeight="16" ContentWidth="16"/>
                            <Separator/>

                            <n:ExtendedMenuItem Header="{DynamicResource S.Options.Recorder.Frequency.Manual}" IsCheckable="True" Icon="{StaticResource Vector.Camera}" ContentHeight="16" ContentWidth="16" 
                                                IsChecked="{Binding CaptureFrequency, Source={x:Static t:UserSettings.All}, Converter={StaticResource EnumToBool}, ConverterParameter={x:Static u:CaptureFrequency.Manual}}" 
                                                IsEnabled="{Binding RelativeSource={RelativeSource Self}, Path=IsChecked, Converter={StaticResource InvertedBool}}" 
                                                Command="{Binding SwitchFrequencyCommand}" CommandParameter="{x:Static u:CaptureFrequency.Manual}"/>

                            <n:ExtendedMenuItem Header="{DynamicResource S.Options.Recorder.Frequency.Interaction}" IsCheckable="True" Icon="{StaticResource Vector.Cursor}" ContentHeight="16" ContentWidth="16" 
                                                IsChecked="{Binding CaptureFrequency, Source={x:Static t:UserSettings.All}, Converter={StaticResource EnumToBool}, ConverterParameter={x:Static u:CaptureFrequency.Interaction}}" 
                                                IsEnabled="{Binding RelativeSource={RelativeSource Self}, Path=IsChecked, Converter={StaticResource InvertedBool}, UpdateSourceTrigger=PropertyChanged}" 
                                                Command="{Binding SwitchFrequencyCommand}" CommandParameter="{x:Static u:CaptureFrequency.Interaction}"/>
                            
                            <n:ExtendedMenuItem Header="{DynamicResource S.Options.Recorder.Frequency.Second}" IsCheckable="True" Icon="{StaticResource Vector.Delay}" ContentHeight="16" ContentWidth="16" 
                                                IsChecked="{Binding CaptureFrequency, Source={x:Static t:UserSettings.All}, Converter={StaticResource EnumToBool}, ConverterParameter={x:Static u:CaptureFrequency.PerSecond}}" 
                                                IsEnabled="{Binding RelativeSource={RelativeSource Self}, Path=IsChecked, Converter={StaticResource InvertedBool}}" 
                                                Command="{Binding SwitchFrequencyCommand}" CommandParameter="{x:Static u:CaptureFrequency.PerSecond}"/>

                            <n:ExtendedMenuItem Header="{DynamicResource S.Options.Recorder.Frequency.Minute}" IsCheckable="True" Icon="{StaticResource Vector.Delay.Minute}" ContentHeight="16" ContentWidth="16" 
                                                IsChecked="{Binding CaptureFrequency, Source={x:Static t:UserSettings.All}, Converter={StaticResource EnumToBool}, ConverterParameter={x:Static u:CaptureFrequency.PerMinute}}" 
                                                IsEnabled="{Binding RelativeSource={RelativeSource Self}, Path=IsChecked, Converter={StaticResource InvertedBool}}" 
                                                Command="{Binding SwitchFrequencyCommand}" CommandParameter="{x:Static u:CaptureFrequency.PerMinute}"/>

                            <n:ExtendedMenuItem Header="{DynamicResource S.Options.Recorder.Frequency.Hour}" IsCheckable="True" Icon="{StaticResource Vector.Delay.Hour}" ContentHeight="16" ContentWidth="16" 
                                                IsChecked="{Binding CaptureFrequency, Source={x:Static t:UserSettings.All}, Converter={StaticResource EnumToBool}, ConverterParameter={x:Static u:CaptureFrequency.PerHour}}" 
                                                IsEnabled="{Binding RelativeSource={RelativeSource Self}, Path=IsChecked, Converter={StaticResource InvertedBool}}" 
                                                Command="{Binding SwitchFrequencyCommand}" CommandParameter="{x:Static u:CaptureFrequency.PerHour}"/>
                        </ContextMenu>
                    </n:ExtendedButton.ContextMenu>
                </n:ExtendedButton>

                <Separator Width="1" Margin="5,2"/>

                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    
                    <Grid.IsEnabled>
                        <MultiBinding Converter="{StaticResource BoolOr}" ConverterParameter="0">
                            <Binding ElementName="StopButton" Path="IsEnabled"/>
                            <Binding ElementName="PauseButton" Path="IsEnabled"/>
                        </MultiBinding>
                    </Grid.IsEnabled>

                    <n:IntegerBox Grid.Column="0" x:Name="WidthIntegerBox" Value="{Binding ElementName=RecorderLightWindow, Path=Width, Mode=TwoWay}"
                                  Offset="{x:Static u:Constants.HorizontalOffset}" Minimum="100" Maximum="3000" TabIndex="6" Height="Auto" Padding="4,0" Margin="1,3"
                                  ToolTip="{DynamicResource S.Recorder.Width}" ToolTipService.Placement="Bottom" ToolTipService.HorizontalOffset="-5"
                                  PropagateWheelEvent="True" MouseWheel="SizeIntegerBox_MouseWheel"/>

                    <Label Grid.Column="1" Content="×" FontSize="16" FontFamily="Segoe Script" Margin="1" VerticalContentAlignment="Center" Padding="0" 
                           Foreground="{Binding ElementName=RecorderLightWindow, Path=Foreground}"/>

                    <n:IntegerBox Grid.Column="2" x:Name="HeightIntegerBox" Value="{Binding ElementName=RecorderLightWindow, Path=Height, Mode=TwoWay}"
                                  Offset="{x:Static u:Constants.VerticalOffset}" Minimum="100" Maximum="3000" TabIndex="7" Height="Auto" Padding="4,0" Margin="1,3"
                                  ToolTip="{DynamicResource S.Recorder.Height}" ToolTipService.Placement="Bottom" ToolTipService.HorizontalOffset="-5"
                                  PropagateWheelEvent="True" MouseWheel="SizeIntegerBox_MouseWheel"/>

                    <TextBlock Grid.Column="3" Text="px" FontSize="12" FontFamily="Segoe UI" Margin="1,0,0,0" VerticalAlignment="Center" Padding="0" 
                               Foreground="{Binding ElementName=RecorderLightWindow, Path=Foreground}"/>
                </Grid>

                <Separator Width="1" Margin="5,2"/>

                <!--Discard-->
                <n:ExtendedButton x:Name="DiscardButton" Icon="{DynamicResource Vector.Remove}" ContentHeight="18" ContentWidth="18" TabIndex="5" Text="{DynamicResource S.Recorder.Discard}"
                                  MinWidth="31" Style="{Binding ButtonStyle, FallbackValue={StaticResource Style.Button.Horizontal}}" ToolTip="{DynamicResource S.Recorder.Discard}" 
                                  Command="{Binding DiscardCommand}" KeyGesture="{Binding DiscardKeyGesture, Converter={StaticResource KeyGestureToString}, UpdateSourceTrigger=PropertyChanged}" 
                                  Visibility="{Binding RelativeSource={RelativeSource Self}, Path=IsEnabled, Converter={StaticResource Bool2Visibility}}"/>
                
                <!--Snap-->
                <n:ExtendedButton x:Name="SnapButton" Icon="{StaticResource Vector.Camera.Add}" ContentHeight="18" ContentWidth="18" TabIndex="6" Text="{DynamicResource S.Recorder.Snap}"
                                  MinWidth="31" Style="{Binding ButtonStyle, FallbackValue={StaticResource Style.Button.Horizontal}}" ToolTip="{DynamicResource S.Recorder.Snap}" 
                                  Command="{Binding SnapCommand}" KeyGesture="{Binding RecordKeyGesture, Converter={StaticResource KeyGestureToString}, UpdateSourceTrigger=PropertyChanged}"
                                  Visibility="{Binding RelativeSource={RelativeSource Self}, Path=IsEnabled, Converter={StaticResource Bool2Visibility}}"/>

                <!--Record-->
                <n:ExtendedButton x:Name="RecordButton" Icon="{StaticResource Vector.Record}" ContentHeight="18" ContentWidth="18" TabIndex="6" Text="{DynamicResource S.Recorder.Record}"
                                  MinWidth="31" Style="{Binding ButtonStyle, FallbackValue={StaticResource Style.Button.Horizontal}}" ToolTip="{DynamicResource S.Recorder.Record}"
                                  Command="{Binding RecordCommand}" KeyGesture="{Binding RecordKeyGesture, Converter={StaticResource KeyGestureToString}, UpdateSourceTrigger=PropertyChanged}" 
                                  Visibility="{Binding RelativeSource={RelativeSource Self}, Path=IsEnabled, Converter={StaticResource Bool2Visibility}}"/>

                <!--Pause-->
                <n:ExtendedButton x:Name="PauseButton" Icon="{StaticResource Vector.Pause}" ContentHeight="18" ContentWidth="18" TabIndex="6" Text="{DynamicResource S.Recorder.Pause}"
                                  MinWidth="31" Style="{Binding ButtonStyle, FallbackValue={StaticResource Style.Button.Horizontal}}" ToolTip="{DynamicResource S.Recorder.Pause}"
                                  Command="{Binding PauseCommand}" KeyGesture="{Binding RecordKeyGesture, Converter={StaticResource KeyGestureToString}, UpdateSourceTrigger=PropertyChanged}"
                                  Visibility="{Binding RelativeSource={RelativeSource Self}, Path=IsEnabled, Converter={StaticResource Bool2Visibility}}"/>

                <!--Stop-->
                <n:ExtendedButton x:Name="StopButton" Icon="{DynamicResource Vector.Stop}" ContentHeight="18" ContentWidth="18" TabIndex="7" Text="{DynamicResource S.Recorder.Stop}"
                                  MinWidth="31" Style="{Binding ButtonStyle, FallbackValue={StaticResource Style.Button.Horizontal}}" ToolTip="{DynamicResource S.Recorder.Stop}"
                                  Command="{Binding StopCommand}" KeyGesture="{Binding StopKeyGesture, Converter={StaticResource KeyGestureToString}, UpdateSourceTrigger=PropertyChanged}"
                                  Visibility="{Binding RelativeSource={RelativeSource Self}, Path=IsEnabled, Converter={StaticResource Bool2Visibility}}"/>
            </StackPanel>
        </Grid>
    </Grid>
</n:LightWindow>