<ResourceDictionary 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:c="clr-namespace:ScreenToGif.Util.Converters"
                    xmlns:u="clr-namespace:ScreenToGif.Util"
                    xmlns:s="clr-namespace:System;assembly=mscorlib"
                    xmlns:r="clr-namespace:ScreenToGif.Controls.Ribbon"
                    xmlns:t="clr-namespace:ScreenToGif.Settings">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/ScreenToGif;component/Themes/Common.xaml"/>
        <ResourceDictionary Source="/ScreenToGif;component/Themes/EncoderListViewItem.xaml"/>
        <ResourceDictionary Source="/ScreenToGif;component/Themes/Ribbon.xaml"/>
        <ResourceDictionary Source="/ScreenToGif;component/Themes/Controls/ExtendedComboBox.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <!--Converters-->
    <BooleanToVisibilityConverter x:Key="Bool2VisibilityConverterGeneric"/>
    <c:StringToInt x:Key="StringToInt"/>
    <c:ContentToVisibility x:Key="ContentToVisibility"/>
    <c:UriToBitmap x:Key="UriToBitmapConverter"/>
    <c:IntToDelayString x:Key="IntToDelayStringConverter"/>
    <c:DoubleToPercentage x:Key="DoubleToPercentageConverter"/>
    <c:BytesToSize x:Key="BytesToSizeConverter"/>
    <c:ColorToAlpha x:Key="ColorToAlphaConverter"/>
    <c:IntToString x:Key="IntToStringConverter"/>
    <c:MultiLineTitle x:Key="MultiLineTitleConverter"/>
    <c:KeysToString x:Key="KeysToString"/>
    <c:IntToRect x:Key="IntToRect"/>
    <c:ColorToBrush x:Key="ColorToBrush"/>
    <c:InvertedBool x:Key="InvertedBool"/>
    <c:ScaleConverter x:Key="ScaleConverter"/>
    <c:CenterPopupConverter x:Key="CenterPopupConverter"/>
    <c:BoolAndToVisibility x:Key="BoolAndToVisibility"/>
    <c:IntToBool x:Key="IntToBool"/>
    <c:EnumToBool x:Key="EnumToBool"/>
    <c:TimeSpanToTotalMilliseconds x:Key="TimeSpanToTotalMilliseconds"/>

    <!--Window Style -->
    <Style TargetType="{x:Type n:LightWindow}">
        <Setter Property="WindowStyle" Value="None"/>
        <Setter Property="ResizeMode" Value="NoResize"/>
        <Setter Property="Background" Value="{DynamicResource Panel.Background}"/>
        <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="BorderBrush" Value="{DynamicResource Element.Border.Weak}"/>
        <Setter Property="MinHeight" Value="100"/>
        <Setter Property="MinWidth" Value="180"/>
        <Setter Property="Title" Value="ScreenToGif"/>
        <Setter Property="SnapsToDevicePixels" Value="False"/>
        <Setter Property="UseLayoutRounding" Value="False"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:LightWindow}">
                    <Border x:Name="MainBorder" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
                        <AdornerDecorator>
                            <Grid x:Name="MainGrid" Background="{x:Null}">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="5" x:Name="FirstRow"/>
                                    <RowDefinition Height="25" x:Name="SecondRow"/>
                                    <RowDefinition/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>

                                <Grid Grid.Row="0" Grid.Column="1" Grid.RowSpan="2" x:Name="TopGrid" Background="{TemplateBinding Background}">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>

                                    <TextBlock Grid.Column="0" x:Name="CaptionText" Text="{TemplateBinding Title}" FontFamily="Segoe UI" FontSize="16" VerticalAlignment="Center"
                                               FontWeight="Regular" Margin="5,0,0,0" Foreground="{TemplateBinding Foreground}"/>

                                    <TextBlock Grid.Column="1" Text="{DynamicResource S.Recorder.ClickOrPress}" VerticalAlignment="Center" TextAlignment="Center" Margin="5" 
                                                   Foreground="{DynamicResource Element.Foreground.Gray112}">
                                        <TextBlock.Visibility>
                                            <MultiBinding Converter="{StaticResource BoolAndToVisibility}">
                                                <Binding Source="{x:Static t:UserSettings.All}" Path="CaptureFrequency" Converter="{StaticResource EnumToBool}" ConverterParameter="{x:Static u:CaptureFrequency.Interaction}"/>
                                                <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="FrameCount" Converter="{StaticResource IntToBool}" ConverterParameter="0"/>
                                            </MultiBinding>
                                        </TextBlock.Visibility>
                                    </TextBlock>

                                    <n:DisplayTimer Grid.Column="2" x:Name="DisplayTimer" Margin="5" CornerRadius="3" Padding="5,0" CapturedCount="{TemplateBinding FrameCount}" IsImpreciseCapture="{TemplateBinding HasImpreciseCapture}"/>

                                    <n:ExtendedButton Grid.Column="3" x:Name="MinimizeButton" Style="{DynamicResource Style.Button.NoText}" Icon="{DynamicResource Vector.Minimize}" 
                                                      Width="30" Padding="6" ContentWidth="14" ContentHeight="14" TabIndex="9"/>
                                    <n:ExtendedButton Grid.Column="4" x:Name="CloseButton" Style="{DynamicResource Style.Button.NoText}" Icon="{DynamicResource Vector.Close}" 
                                                      Width="30" Padding="6" ContentWidth="14" ContentHeight="14" TabIndex="10"/>
                                </Grid>

                                <Rectangle Grid.Row="0" Grid.Column="0" x:Name="TopLeftRectangle" Stroke="{x:Null}" Fill="{TemplateBinding Background}" Cursor="SizeNWSE" Width="5" Height="5"/>
                                <Rectangle Grid.Row="0" Grid.Column="1" x:Name="TopRectangle" Stroke="{x:Null}" Fill="Transparent" Cursor="SizeNS" Height="5"/>
                                <Rectangle Grid.Row="0" Grid.Column="2" x:Name="TopRightRectangle" Stroke="{x:Null}" Fill="{TemplateBinding Background}" Cursor="SizeNESW" Width="5" Height="5"/>
                                <Rectangle Grid.Row="1" Grid.Column="0" Grid.RowSpan="2" x:Name="LeftRectangle" Stroke="{x:Null}" Fill="{TemplateBinding Background}" Cursor="SizeWE" Width="5"/>

                                <ContentPresenter Grid.Row="2" Grid.Column="1" Grid.RowSpan="2" x:Name="Presenter"/>

                                <Rectangle Grid.Row="1" Grid.Column="2" Grid.RowSpan="2" x:Name="RightRectangle" Stroke="{x:Null}" Fill="{TemplateBinding Background}" Cursor="SizeWE" Width="5"/>
                                <Rectangle Grid.Row="3" Grid.Column="0" x:Name="BottomLeftRectangle" Stroke="{x:Null}" Fill="{TemplateBinding Background}" Cursor="SizeNESW" Width="5" Height="5"/>
                                <Rectangle Grid.Row="3" Grid.Column="1" x:Name="BottomRectangle" Stroke="{x:Null}" Fill="Transparent" Cursor="SizeNS" Height="5"/>
                                <Rectangle Grid.Row="3" Grid.Column="2" x:Name="BottomRightRectangle" Stroke="{x:Null}" Fill="{TemplateBinding Background}" Cursor="SizeNWSE" Height="5" Width="5"/>
                            </Grid>
                        </AdornerDecorator>
                    </Border>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsRecording" Value="True">
                            <Setter TargetName="MinimizeButton" Property="IsEnabled" Value="False"/>
                            <Setter TargetName="CloseButton" Property="IsEnabled" Value="False"/>

                            <Setter TargetName="TopLeftRectangle" Property="IsHitTestVisible" Value="False"/>
                            <Setter TargetName="TopRectangle" Property="IsHitTestVisible" Value="False"/>
                            <Setter TargetName="TopRightRectangle" Property="IsHitTestVisible" Value="False"/>
                            <Setter TargetName="LeftRectangle" Property="IsHitTestVisible" Value="False"/>
                            <Setter TargetName="RightRectangle" Property="IsHitTestVisible" Value="False"/>
                            <Setter TargetName="BottomLeftRectangle" Property="IsHitTestVisible" Value="False"/>
                            <Setter TargetName="BottomRectangle" Property="IsHitTestVisible" Value="False"/>
                            <Setter TargetName="BottomRightRectangle" Property="IsHitTestVisible" Value="False"/>
                        </Trigger>

                        <Trigger Property="IsThin" Value="True">
                            <Setter TargetName="FirstRow" Property="Height" Value="2"/>
                            <Setter TargetName="SecondRow" Property="Height" Value="0"/>
                            <Setter TargetName="TopGrid" Property="Visibility" Value="Collapsed"/>

                            <Setter TargetName="TopRectangle" Property="Fill" Value="{Binding ElementName=LeftRectangle, Path=Fill}"/>
                            <Setter TargetName="TopRectangle" Property="Height" Value="2"/>
                            <Setter TargetName="BottomRectangle" Property="Height" Value="2"/>
                            <Setter TargetName="LeftRectangle" Property="Width" Value="2"/>
                            <Setter TargetName="RightRectangle" Property="Width" Value="2"/>
                            <Setter TargetName="BottomLeftRectangle" Property="Width" Value="2"/>
                            <Setter TargetName="BottomRightRectangle" Property="Width" Value="2"/>
                            <Setter TargetName="TopLeftRectangle" Property="Width" Value="2"/>
                            <Setter TargetName="TopRightRectangle" Property="Width" Value="2"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--ExtendedTexBox Style-->
    <Style TargetType="{x:Type n:ExtendedTextBox}">
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>
        <Setter Property="Background" Value="{DynamicResource Element.Background}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource Element.Border}"/>
        <Setter Property="Padding" Value="2"/>
        <Setter Property="MinHeight" Value="23"/>
        <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="AllowDrop" Value="True"/>
        <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:ExtendedTextBox}">
                    <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" 
                            VerticalAlignment="{TemplateBinding VerticalAlignment}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" SnapsToDevicePixels="True"
                            Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" MinWidth="{TemplateBinding MinWidth}" MinHeight="{TemplateBinding MinHeight}">
                        <Grid x:Name="InnerGrid">
                            <ScrollViewer x:Name="PART_ContentHost" Focusable="False" HorizontalScrollBarVisibility="Hidden" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalScrollBarVisibility="Hidden" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>

                            <TextBlock x:Name="WatermarkTextBlock" Text="{TemplateBinding Watermark}" IsHitTestVisible="False" Foreground="{DynamicResource Element.Foreground.Watermark}"
                                       Padding="3,2" Visibility="Collapsed" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>

                            <Path x:Name="InnerPath" Data="M 0,0 6,6 0,6 z" Fill="{DynamicResource Element.Border.Required}" HorizontalAlignment="Left" 
                                  VerticalAlignment="Bottom" Opacity="0" ToolTip="{DynamicResource S.Required}"/>
                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsObligatory" Value="True"/>
                                <Condition Property="Text" Value="{x:Static s:String.Empty}"/>
                            </MultiTrigger.Conditions>

                            <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Element.Border.Required}"/>
                            <Setter Property="Opacity" TargetName="InnerPath" Value="1"/>
                        </MultiTrigger>
                        <Trigger Property="IsReadOnly" Value="True">
                            <Setter Property="Background" TargetName="border" Value="{DynamicResource Element.Background.ReadOnly}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Opacity" TargetName="border" Value="0.7"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Element.Border.Hover}"/>
                            <Setter Property="Fill" TargetName="InnerPath" Value="{DynamicResource Element.Border.Hover}"/>
                        </Trigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Text" Value="{x:Static s:String.Empty}"/>
                                <Condition Property="IsKeyboardFocused" Value="False"/>
                            </MultiTrigger.Conditions>

                            <Setter Property="Visibility" TargetName="WatermarkTextBlock" Value="Visible"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Text" Value="{x:Null}"/>
                                <Condition Property="IsKeyboardFocused" Value="False"/>
                            </MultiTrigger.Conditions>

                            <Setter Property="Visibility" TargetName="WatermarkTextBlock" Value="Visible"/>
                        </MultiTrigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsKeyboardFocused" Value="True"/>
                                <Condition Property="IsReadOnly" Value="False"/>
                            </MultiTrigger.Conditions>

                            <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Element.Border.Pressed}"/>
                            <Setter Property="Background" TargetName="border" Value="{DynamicResource Element.Background.Focused}"/>
                            <Setter Property="Fill" TargetName="InnerPath" Value="{DynamicResource Element.Border.Pressed}"/>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <!--IntegerBox Style-->
    <Style TargetType="{x:Type n:IntegerBox}">
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Height" Value="23"/>
        <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>
        <Setter Property="Background" Value="{DynamicResource Element.Background}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource Element.Border}"/>
        <Setter Property="MaxLength" Value="9"/>
        <Setter Property="Padding" Value="2,0"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:IntegerBox}">
                    <Border x:Name="border" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" 
                            BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}" VerticalAlignment="{TemplateBinding VerticalAlignment}"
                            HorizontalAlignment="{TemplateBinding HorizontalAlignment}" SnapsToDevicePixels="True">
                        <Border x:Name="InnerBorder">
                            <Grid x:Name="InnerGrid">
                                <ScrollViewer x:Name="PART_ContentHost" Focusable="False" HorizontalScrollBarVisibility="Hidden"
                                              VerticalScrollBarVisibility="Hidden" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>

                                <TextBlock x:Name="WatermarkTextBlock" Text="{TemplateBinding Watermark}" IsHitTestVisible="False" Foreground="{DynamicResource Element.Foreground.Watermark}"
                                           Padding="3,2" Visibility="Collapsed"/>

                                <Path x:Name="InnerPath" Data="M 0,0 6,6 0,6 z" Fill="{DynamicResource Element.Border.Required}" HorizontalAlignment="Left" 
                                      VerticalAlignment="Bottom" Opacity="0" ToolTip="{DynamicResource S.Required}"/>
                            </Grid>
                        </Border>
                    </Border>

                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsObligatory" Value="True"/>
                                <Condition Property="Text" Value="{x:Static s:String.Empty}"/>
                            </MultiTrigger.Conditions>

                            <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Element.Border.Required}"/>
                            <Setter Property="Opacity" TargetName="InnerPath" Value="1"/>
                        </MultiTrigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsObligatory" Value="True"/>
                                <Condition Property="Value" Value="0"/>
                            </MultiTrigger.Conditions>

                            <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Element.Border.Required}"/>
                            <Setter Property="Opacity" TargetName="InnerPath" Value="1"/>
                        </MultiTrigger>

                        <Trigger Property="IsReadOnly" Value="True">
                            <Setter Property="Background" TargetName="border" Value="{DynamicResource Element.Background.ReadOnly}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Opacity" TargetName="border" Value="0.7"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Element.Border.Hover}"/>
                            <Setter Property="Fill" TargetName="InnerPath" Value="{DynamicResource Element.Border.Hover}"/>
                        </Trigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Text" Value="{x:Static s:String.Empty}"/>
                                <Condition Property="IsKeyboardFocused" Value="False"/>
                            </MultiTrigger.Conditions>

                            <Setter Property="Visibility" TargetName="WatermarkTextBlock" Value="Visible"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Text" Value="{x:Null}"/>
                                <Condition Property="IsKeyboardFocused" Value="False"/>
                            </MultiTrigger.Conditions>

                            <Setter Property="Visibility" TargetName="WatermarkTextBlock" Value="Visible"/>
                        </MultiTrigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsKeyboardFocused" Value="True"/>
                                <Condition Property="IsReadOnly" Value="False"/>
                            </MultiTrigger.Conditions>

                            <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Element.Border.Pressed}"/>
                            <Setter Property="Background" TargetName="border" Value="{DynamicResource Element.Background.Focused}"/>
                            <Setter Property="Fill" TargetName="InnerPath" Value="{DynamicResource Element.Border.Pressed}"/>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--IntegerUpDown Style-->
    <Style TargetType="{x:Type n:IntegerUpDown}">
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="Background" Value="{DynamicResource Element.Background}"/>
        <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource Element.Border}"/>
        <Setter Property="BorderThickness" Value="1"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:IntegerUpDown}">
                    <Border Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" MinWidth="{TemplateBinding MinWidth}"
                            BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
                        <Grid Background="{TemplateBinding Background}">
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition Height="1"/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="55*"/>
                                <ColumnDefinition Width="1"/>
                                <ColumnDefinition Width="45*" MinWidth="20" MaxWidth="25"/>
                            </Grid.ColumnDefinitions>

                            <ScrollViewer Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" x:Name="PART_ContentHost" Focusable="False" 
                                          HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"
                                          VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                          HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"/>

                            <Separator Grid.Row="0" Grid.Column="1" Grid.RowSpan="3" x:Name="VeticalSeparator" Width="1" Margin="0" 
                                       VerticalAlignment="Stretch" Visibility="Collapsed" BorderBrush="{DynamicResource Element.Border.Medium}"/>

                            <RepeatButton Grid.Row="0" Grid.Column="2" x:Name="UpButton" Content="▲" IsTabStop="False" Focusable="False"
                                          Style="{StaticResource Style.RepeatButton}" FontSize="8" VerticalContentAlignment="Center" 
                                          BorderThickness="0" Padding="0,-1,0,0" Margin="0"/>

                            <Separator Grid.Row="1" Grid.Column="2" x:Name="HorizontalSeparator" Height="1" Margin="0"
                                       HorizontalAlignment="Stretch" Visibility="Collapsed" BorderBrush="{DynamicResource Element.Border.Medium}"/>

                            <RepeatButton Grid.Row="2" Grid.Column="2" x:Name="DownButton" Content="▼" IsTabStop="False" Focusable="False"
                                          Style="{StaticResource Style.RepeatButton}" FontSize="8" VerticalContentAlignment="Center" 
                                          BorderThickness="0" Padding="0,-1,0,0" Margin="0"/>
                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="VeticalSeparator" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger SourceName="UpButton" Property="IsMouseOver" Value="True">
                            <Setter TargetName="HorizontalSeparator" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger SourceName="DownButton" Property="IsMouseOver" Value="True">
                            <Setter TargetName="HorizontalSeparator"  Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Visibility" TargetName="UpButton" Value="Hidden"/>
                            <Setter Property="Visibility" TargetName="DownButton" Value="Hidden"/>
                            <Setter Property="Visibility" TargetName="HorizontalSeparator" Value="Visible"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="BorderBrush" Value="{DynamicResource Element.Border.Hover}"/>
            </Trigger>
            <Trigger Property="IsKeyboardFocused" Value="True">
                <Setter Property="Background" Value="{DynamicResource Element.Background.Focused}"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" Value="0.7"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <!--NullableIntegerBox Style-->
    <Style TargetType="{x:Type n:NullableIntegerBox}" BasedOn="{StaticResource {x:Type n:ExtendedTextBox}}">
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    </Style>

    <!--NullableIntegerUpDown Style-->
    <Style TargetType="{x:Type n:NullableIntegerUpDown}">
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="Background" Value="{DynamicResource Element.Background}"/>
        <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource Element.Border}"/>
        <Setter Property="BorderThickness" Value="1"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:NullableIntegerUpDown}">
                    <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}"
                            Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" MinWidth="{TemplateBinding MinWidth}">
                        <Grid Background="{TemplateBinding Background}">
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition Height="1"/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="55*"/>
                                <ColumnDefinition Width="1"/>
                                <ColumnDefinition Width="45*" MinWidth="20" MaxWidth="25"/>
                            </Grid.ColumnDefinitions>

                            <ScrollViewer Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" x:Name="PART_ContentHost" Focusable="False" 
                                          HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"
                                          VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                          HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"/>

                            <Separator Grid.Row="0" Grid.Column="1" Grid.RowSpan="3" x:Name="VeticalSeparator" Width="1" Margin="0" 
                                       VerticalAlignment="Stretch" Visibility="Collapsed" BorderBrush="{DynamicResource Element.Border.Medium}"/>

                            <RepeatButton Grid.Row="0" Grid.Column="2" x:Name="UpButton" Content="▲" IsTabStop="False" Focusable="False"
                                          Style="{StaticResource Style.RepeatButton}" FontSize="8" VerticalContentAlignment="Center" 
                                          BorderThickness="0" Padding="0,-1,0,0" Margin="0"/>

                            <Separator Grid.Row="1" Grid.Column="2" x:Name="HorizontalSeparator" Height="1" Margin="0"
                                       HorizontalAlignment="Stretch" Visibility="Collapsed" BorderBrush="{DynamicResource Element.Border.Medium}"/>

                            <RepeatButton Grid.Row="2" Grid.Column="2" x:Name="DownButton" Content="▼" IsTabStop="False" Focusable="False"
                                          Style="{StaticResource Style.RepeatButton}" FontSize="8" VerticalContentAlignment="Center" 
                                          BorderThickness="0" Padding="0,-1,0,0" Margin="0"/>
                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="VeticalSeparator" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger SourceName="UpButton" Property="IsMouseOver" Value="True">
                            <Setter TargetName="HorizontalSeparator" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger SourceName="DownButton" Property="IsMouseOver" Value="True">
                            <Setter TargetName="HorizontalSeparator"  Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Visibility" TargetName="UpButton" Value="Hidden"/>
                            <Setter Property="Visibility" TargetName="DownButton" Value="Hidden"/>
                            <Setter Property="Visibility" TargetName="HorizontalSeparator" Value="Visible"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="BorderBrush" Value="{DynamicResource Element.Border.Hover}"/>
            </Trigger>
            <Trigger Property="IsKeyboardFocused" Value="True">
                <Setter Property="Background" Value="{DynamicResource Element.Background.Focused}"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" Value="0.7"/>
            </Trigger>
        </Style.Triggers>
    </Style>
    
    <!--DoubleBox Style-->
    <Style TargetType="{x:Type n:DoubleBox}" BasedOn="{StaticResource {x:Type n:ExtendedTextBox}}">
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    </Style>

    <!--DoubleUpDown Style-->
    <Style TargetType="{x:Type n:DoubleUpDown}">
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="Background" Value="{DynamicResource Element.Background}"/>
        <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource Element.Border}"/>
        <Setter Property="BorderThickness" Value="1"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:DoubleUpDown}">
                    <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}"
                            Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" MinWidth="{TemplateBinding MinWidth}">
                        <Grid Background="{TemplateBinding Background}">
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition Height="1"/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="55*"/>
                                <ColumnDefinition Width="1"/>
                                <ColumnDefinition Width="45*" MinWidth="20" MaxWidth="25"/>
                            </Grid.ColumnDefinitions>

                            <ScrollViewer Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" x:Name="PART_ContentHost" Focusable="False" 
                                          HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"
                                          VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                          HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"/>

                            <Separator Grid.Row="0" Grid.Column="1" Grid.RowSpan="3" x:Name="VeticalSeparator" Width="1" Margin="0" 
                                       VerticalAlignment="Stretch" Visibility="Collapsed" BorderBrush="{DynamicResource Element.Border.Medium}"/>

                            <RepeatButton Grid.Row="0" Grid.Column="2" x:Name="UpButton" Content="▲" IsTabStop="False" Focusable="False"
                                          Style="{StaticResource Style.RepeatButton}" FontSize="8" VerticalContentAlignment="Center" 
                                          BorderThickness="0" Padding="0,-1,0,0" Margin="0"/>

                            <Separator Grid.Row="1" Grid.Column="2" x:Name="HorizontalSeparator" Height="1" Margin="0"
                                       HorizontalAlignment="Stretch" Visibility="Collapsed" BorderBrush="{DynamicResource Element.Border.Medium}"/>

                            <RepeatButton Grid.Row="2" Grid.Column="2" x:Name="DownButton" Content="▼" IsTabStop="False" Focusable="False"
                                          Style="{StaticResource Style.RepeatButton}" FontSize="8" VerticalContentAlignment="Center" 
                                          BorderThickness="0" Padding="0,-1,0,0" Margin="0"/>
                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="VeticalSeparator" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger SourceName="UpButton" Property="IsMouseOver" Value="True">
                            <Setter TargetName="HorizontalSeparator" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger SourceName="DownButton" Property="IsMouseOver" Value="True">
                            <Setter TargetName="HorizontalSeparator"  Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Visibility" TargetName="UpButton" Value="Hidden"/>
                            <Setter Property="Visibility" TargetName="DownButton" Value="Hidden"/>
                            <Setter Property="Visibility" TargetName="HorizontalSeparator" Value="Visible"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="BorderBrush" Value="{DynamicResource Element.Border.Hover}"/>
            </Trigger>
            <Trigger Property="IsKeyboardFocused" Value="True">
                <Setter Property="Background" Value="{DynamicResource Element.Background.Focused}"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" Value="0.7"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <!--DecimalBox Style-->
    <Style TargetType="{x:Type n:DecimalBox}" BasedOn="{StaticResource {x:Type n:ExtendedTextBox}}">
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    </Style>

    <!--DecimalUpDown Style-->
    <Style TargetType="{x:Type n:DecimalUpDown}">
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="Background" Value="{DynamicResource Element.Background}"/>
        <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource Element.Border}"/>
        <Setter Property="BorderThickness" Value="1"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:DecimalUpDown}">
                    <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}"
                            Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" MinWidth="{TemplateBinding MinWidth}">
                        <Grid Background="{TemplateBinding Background}">
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition Height="1"/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="55*"/>
                                <ColumnDefinition Width="1"/>
                                <ColumnDefinition Width="45*" MinWidth="20" MaxWidth="25"/>
                            </Grid.ColumnDefinitions>

                            <ScrollViewer Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" x:Name="PART_ContentHost" Focusable="False" 
                                          HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"
                                          VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                          HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"/>

                            <Separator Grid.Row="0" Grid.Column="1" Grid.RowSpan="3" x:Name="VeticalSeparator" Width="1" Margin="0" 
                                       VerticalAlignment="Stretch" Visibility="Collapsed" BorderBrush="{DynamicResource Element.Border.Medium}"/>

                            <RepeatButton Grid.Row="0" Grid.Column="2" x:Name="UpButton" Content="▲" IsTabStop="False" Focusable="False"
                                          Style="{StaticResource Style.RepeatButton}" FontSize="8" VerticalContentAlignment="Center" 
                                          BorderThickness="0" Padding="0,-1,0,0" Margin="0"/>

                            <Separator Grid.Row="1" Grid.Column="2" x:Name="HorizontalSeparator" Height="1" Margin="0"
                                       HorizontalAlignment="Stretch" Visibility="Collapsed" BorderBrush="{DynamicResource Element.Border.Medium}"/>

                            <RepeatButton Grid.Row="2" Grid.Column="2" x:Name="DownButton" Content="▼" IsTabStop="False" Focusable="False"
                                          Style="{StaticResource Style.RepeatButton}" FontSize="8" VerticalContentAlignment="Center" 
                                          BorderThickness="0" Padding="0,-1,0,0" Margin="0"/>
                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="VeticalSeparator" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger SourceName="UpButton" Property="IsMouseOver" Value="True">
                            <Setter TargetName="HorizontalSeparator" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger SourceName="DownButton" Property="IsMouseOver" Value="True">
                            <Setter TargetName="HorizontalSeparator"  Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Visibility" TargetName="UpButton" Value="Hidden"/>
                            <Setter Property="Visibility" TargetName="DownButton" Value="Hidden"/>
                            <Setter Property="Visibility" TargetName="HorizontalSeparator" Value="Visible"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="BorderBrush" Value="{DynamicResource Element.Border.Hover}"/>
            </Trigger>
            <Trigger Property="IsKeyboardFocused" Value="True">
                <Setter Property="Background" Value="{DynamicResource Element.Background.Focused}"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" Value="0.7"/>
            </Trigger>
        </Style.Triggers>
    </Style>
    
    <!--HexaDecimalBox Style-->
    <Style TargetType="{x:Type n:HexadecimalBox}">
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Height" Value="23"/>
        <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>
        <Setter Property="Background" Value="{DynamicResource Element.Background}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource Element.Border}"/>
        <Setter Property="MaxLength" Value="9"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:HexadecimalBox}">
                    <Border Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" MinWidth="{TemplateBinding MinWidth}"
                            BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}" VerticalAlignment="{TemplateBinding VerticalAlignment}"
                            HorizontalAlignment="{TemplateBinding HorizontalAlignment}" SnapsToDevicePixels="True">
                        <ScrollViewer x:Name="PART_ContentHost" Focusable="False" HorizontalScrollBarVisibility="Hidden"
                                      VerticalScrollBarVisibility="Hidden" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="BorderBrush" Value="{DynamicResource Element.Border.Hover}"/>
            </Trigger>
            <Trigger Property="IsKeyboardFocused" Value="True">
                <Setter Property="BorderBrush" Value="{DynamicResource Element.Border.Pressed}"/>
                <Setter Property="Background" Value="{DynamicResource Element.Background.Focused}"/>
            </Trigger>
            <Trigger Property="IsReadOnly" Value="True">
                <Setter Property="Background" Value="{DynamicResource Element.Background.ReadOnly}"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" Value="0.7"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <!--KeyBox Style-->
    <Style TargetType="{x:Type n:KeyBox}">
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Height" Value="23"/>
        <Setter Property="MinWidth" Value="50"/>
        <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>
        <Setter Property="Background" Value="{DynamicResource Element.Background}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource Element.Border}"/>
        <Setter Property="Focusable" Value="True"/>
        <Setter Property="ToolTip" Value="{DynamicResource S.Options.Shortcuts.Info}"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:KeyBox}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Width="{TemplateBinding Width}"
                            Height="{TemplateBinding Height}" MinWidth="{TemplateBinding MinWidth}" MinHeight="{TemplateBinding MinHeight}" 
                            Background="{TemplateBinding Background}" VerticalAlignment="{TemplateBinding VerticalAlignment}"
                            HorizontalAlignment="{TemplateBinding HorizontalAlignment}" SnapsToDevicePixels="True" Focusable="True">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>

                            <TextBlock Grid.Column="1" x:Name="AltTextBlock" Text="Alt +" Margin="2,0" VerticalAlignment="Center" IsHitTestVisible="False" Visibility="Collapsed"/>
                            <TextBlock Grid.Column="2" x:Name="CtrlTextBlock" Text="Control +" Margin="2,0" VerticalAlignment="Center" IsHitTestVisible="False" Visibility="Collapsed"/>
                            <TextBlock Grid.Column="3" x:Name="ShiftTextBlock" Text="Shift +" Margin="2,0" VerticalAlignment="Center" IsHitTestVisible="False" Visibility="Collapsed"/>
                            <TextBlock Grid.Column="4" x:Name="WindowsTextBlock" Text="Windows +" Margin="2,0" VerticalAlignment="Center" IsHitTestVisible="False" Visibility="Collapsed"/>

                            <TextBlock Grid.Column="0" Grid.ColumnSpan="8" x:Name="CompleteKeyTextBlock" Text="{TemplateBinding Text}" Margin="2,0" 
                                       VerticalAlignment="Center" HorizontalAlignment="Center" TextAlignment="Center" IsHitTestVisible="False" Visibility="Collapsed"/>

                            <n:ExtendedButton Grid.Column="8" x:Name="RemoveButton" Icon="{DynamicResource Vector.Close}" Style="{DynamicResource Style.Button.NoText.Border}" 
                                              ContentWidth="9" ContentHeight="12" Width="16" Margin="1,0,0,0" BorderThickness="1,0,0,0" Height="23" ToolTip="{DynamicResource S.KeyStrokes.Edit.Remove}"/>
                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsControlDown" Value="True">
                            <Setter TargetName="CtrlTextBlock" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsShiftDown" Value="True">
                            <Setter TargetName="ShiftTextBlock" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsAltDown" Value="True">
                            <Setter TargetName="AltTextBlock" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsWindowsDown" Value="True">
                            <Setter TargetName="WindowsTextBlock" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsSelectionFinished" Value="True">
                            <Setter TargetName="CompleteKeyTextBlock" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="AltTextBlock" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="CtrlTextBlock" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="ShiftTextBlock" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="WindowsTextBlock" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="CanRemove" Value="False">
                            <Setter TargetName="RemoveButton" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="BorderBrush" Value="{DynamicResource Element.Border.Hover}"/>
            </Trigger>
            <Trigger Property="IsKeyboardFocusWithin" Value="True">
                <Setter Property="BorderBrush" Value="{DynamicResource Element.Border.Pressed}"/>
                <Setter Property="Background" Value="{DynamicResource Element.Background.Focused}"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" Value="0.7"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <!--HeaderedTooltip Style-->
    <Style TargetType="{x:Type n:HeaderedTooltip}" BasedOn="{StaticResource {x:Type ToolTip}}">
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="Padding" Value="5"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:HeaderedTooltip}">
                    <Border BorderBrush="{DynamicResource Element.Border}" Background="{DynamicResource Element.Background}" BorderThickness="1" Effect="{DynamicResource Shadow.Border.Large}" Margin="5">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>

                            <Border Grid.Row="0" Grid.Column="0" x:Name="ImageBorder" Background="{TemplateBinding Icon}" Opacity="{DynamicResource Element.Opacity}"
                                    Height="{TemplateBinding MaxSize}" Width="{TemplateBinding MaxSize}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                            
                            <Label Grid.Row="0" Grid.Column="1" Content="{TemplateBinding Header}" FontWeight="SemiBold" Foreground="{DynamicResource Element.Foreground.Medium}" 
                                   HorizontalAlignment="Stretch" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"/>

                            <TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" x:Name="PART_InlinesPresenter" Text="{TemplateBinding Text}" 
                                       Foreground="{DynamicResource Element.Foreground.Medium}" Padding="{TemplateBinding Padding}" TextWrapping="WrapWithOverflow" 
                                       HorizontalAlignment="Stretch" TextAlignment="{TemplateBinding TextAlignment}"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--ExtendedMenuItem Style-->
    <Style TargetType="{x:Type n:ExtendedMenuItem}">
        <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}, FallbackValue={x:Static HorizontalAlignment.Left}}"/>
        <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}, FallbackValue={x:Static VerticalAlignment.Center}}"/>
        <Setter Property="Foreground" Value="{DynamicResource Element.Foreground.Medium}"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="FontFamily" Value="Segoe UI"/>
        <Setter Property="FontSize" Value="13"/>
        <Setter Property="FontWeight" Value="Normal"/>
        <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
        <Setter Property="Margin" Value="0"/>
        <Setter Property="Padding" Value="2"/>
        <Setter Property="Height" Value="24"/>

        <!--SubmenuItem-->
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:ExtendedMenuItem}">
                    <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" 
                            Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Uid="Border_38">
                        <Grid x:Name="Grid" Uid="Grid_49">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition SharedSizeGroup="MenuItemIconColumnGroup" MinWidth="24" Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition MinWidth="5" SharedSizeGroup="MenuItemIGTColumnGroup" Width="Auto"/>
                                <ColumnDefinition Width="14"/>
                            </Grid.ColumnDefinitions>

                            <Grid x:Name="CheckSquare" Grid.Column="0" Background="Transparent" Margin="3,0" VerticalAlignment="Center">
                                <Viewbox x:Name="CheckViewBox" Visibility="Collapsed" Height="{TemplateBinding ContentHeight}" Width="{TemplateBinding ContentWidth}" Stretch="Uniform">
                                    <Path x:Name="GlyphPanel" Data="M0,2L0,4.8 2.5,7.4 7.1,2.8 7.1,0 2.5,4.6z" Fill="{TemplateBinding Foreground}" FlowDirection="LeftToRight" Uid="Path_12" Visibility="Hidden"/>
                                </Viewbox>

                                <Border x:Name="ImageBorder" Background="{TemplateBinding Icon}" Opacity="{DynamicResource Element.Opacity}"
                                        Height="{TemplateBinding ContentHeight}" Width="{TemplateBinding ContentWidth}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                            </Grid>

                            <ContentPresenter x:Name="ContentPresenter" ContentTemplate="{TemplateBinding HeaderTemplate}" VerticalAlignment="Center"
                                              Content="{TemplateBinding Header}" Grid.Column="1" ContentSource="Header" Margin="3,0" 
                                              RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Uid="ContentPresenter_33"/>

                            <TextBlock Grid.Column="2" x:Name="InputGestureText" Uid="TextBlock_10" Margin="3,0" Text="{TemplateBinding InputGestureText}" 
                                       Foreground="{DynamicResource Element.Foreground.Gray112}" FontSize="12" FontWeight="Bold" VerticalAlignment="Center"/>
                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
                            <Setter Property="Background" TargetName="CheckSquare" Value="{DynamicResource Element.Background.Hover}"/>
                        </Trigger>
                        <Trigger Property="HasIcon" Value="True">
                            <Setter Property="Visibility" TargetName="ImageBorder" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="HasIcon" Value="False">
                            <Setter Property="Visibility" TargetName="CheckViewBox" Value="Visible"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Style.Triggers>
            <Trigger Property="Role" Value="TopLevelHeader">
                <Setter Property="Foreground" Value="{DynamicResource Element.Foreground.Medium}"/>
                <Setter Property="Margin" Value="0"/>
                <Setter Property="Padding" Value="6,2"/>
                <Setter Property="MinHeight" Value="26"/>
                <Setter Property="MinWidth" Value="50"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type n:ExtendedMenuItem}">
                            <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" 
                                    Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Uid="Border_39">
                                <Grid x:Name="Grid" Uid="Grid_49" IsSharedSizeScope="False">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>

                                    <Grid x:Name="CheckSquare" Grid.Column="0" Background="Transparent" Visibility="Collapsed">
                                        <Viewbox x:Name="CheckViewBox" Visibility="Collapsed" Margin="2,0,0,0" Stretch="Uniform" Height="{TemplateBinding ContentHeight}" Width="{TemplateBinding ContentWidth}">
                                            <Path x:Name="GlyphPanel" Data="M0,2L0,4.8 2.5,7.4 7.1,2.8 7.1,0 2.5,4.6z" Fill="{TemplateBinding Foreground}" FlowDirection="LeftToRight" Margin="4,0,6,0" 
                                                  Uid="Path_12" Visibility="Hidden" VerticalAlignment="Center"/>
                                        </Viewbox>

                                        <Border x:Name="ImageBorder" Background="{TemplateBinding Icon}" Opacity="{DynamicResource Element.Opacity}" Margin="2,0,0,0" Visibility="Collapsed" 
                                                Height="{TemplateBinding ContentHeight}" Width="{TemplateBinding ContentWidth}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                    </Grid>

                                    <ContentPresenter Grid.Column="1" x:Name="ContentPresenter" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" ContentSource="Header" Margin="3,0,6,0"  
                                                      RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Uid="ContentPresenter_35" VerticalAlignment="Center" HorizontalAlignment="Center"/>

                                    <!-- Popup with the SubMenus -->
                                    <Popup Grid.Column="0" Grid.ColumnSpan="2" Name="SubMenuPopup" Placement="Bottom" IsOpen="{TemplateBinding IsSubmenuOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Fade" HorizontalOffset="-2">
                                        <Border Name="SubmenuBorder" SnapsToDevicePixels="True" Background="{DynamicResource Element.Background}" BorderBrush="{DynamicResource Element.Border}" 
                                                BorderThickness="1" Effect="{DynamicResource Shadow.Border.Small}" Margin="1">
                                            <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle"/>
                                        </Border>
                                    </Popup>
                                </Grid>
                            </Border>

                            <ControlTemplate.Triggers>
                                <Trigger Property="IsChecked" Value="True">
                                    <Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
                                    <Setter Property="Background" TargetName="CheckSquare" Value="{DynamicResource Element.Background.Hover}"/>
                                </Trigger>
                                <Trigger Property="HasIcon" Value="True">
                                    <Setter Property="Visibility" TargetName="ImageBorder" Value="Visible"/>
                                    <Setter Property="Visibility" TargetName="CheckSquare" Value="Visible"/>
                                </Trigger>
                                <Trigger Property="HasIcon" Value="False">
                                    <Setter Property="Visibility" TargetName="CheckViewBox" Value="Collapsed"/>
                                    <Setter Property="Visibility" TargetName="CheckSquare" Value="Collapsed"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>

            <Trigger Property="Role" Value="TopLevelItem">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type n:ExtendedMenuItem}">
                            <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" 
                                    Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Uid="Border_39">
                                <Grid x:Name="Grid" Uid="Grid_49" IsSharedSizeScope="False">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition SharedSizeGroup="MenuItemIconColumnGroup" MinWidth="24" Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition MinWidth="5" SharedSizeGroup="MenuItemIGTColumnGroup" Width="Auto"/>
                                        <ColumnDefinition Width="14"/>
                                    </Grid.ColumnDefinitions>

                                    <Grid Grid.Column="0" x:Name="CheckSquare" Background="Transparent" Margin="3,0" Visibility="Collapsed">
                                        <Viewbox x:Name="CheckViewBox" Visibility="Collapsed" Stretch="Uniform" Height="{TemplateBinding ContentHeight}" Width="{TemplateBinding ContentWidth}">
                                            <Path x:Name="GlyphPanel" Data="M0,2L0,4.8 2.5,7.4 7.1,2.8 7.1,0 2.5,4.6z" Fill="{TemplateBinding Foreground}" FlowDirection="LeftToRight"
                                                  Uid="Path_12" Visibility="Hidden" VerticalAlignment="Center"/>
                                        </Viewbox>

                                        <Border x:Name="ImageBorder" Background="{TemplateBinding Icon}" Opacity="{DynamicResource Element.Opacity}" Visibility="Collapsed" 
                                                Height="{TemplateBinding ContentHeight}" Width="{TemplateBinding ContentWidth}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                    </Grid>

                                    <ContentPresenter Grid.Column="1" x:Name="ContentPresenter" ContentTemplate="{TemplateBinding HeaderTemplate}" 
                                                      Content="{TemplateBinding Header}" ContentSource="Header" Margin="3,0" 
                                                      RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                                      Uid="ContentPresenter_35" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                </Grid>
                            </Border>

                            <ControlTemplate.Triggers>
                                <Trigger Property="IsChecked" Value="True">
                                    <Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
                                    <Setter Property="Background" TargetName="CheckSquare" Value="{DynamicResource Element.Background.Hover}"/>
                                </Trigger>
                                <Trigger Property="HasIcon" Value="True">
                                    <Setter Property="Visibility" TargetName="ImageBorder" Value="Visible"/>
                                    <Setter Property="Visibility" TargetName="CheckSquare" Value="Visible"/>
                                </Trigger>
                                <Trigger Property="HasIcon" Value="False">
                                    <Setter Property="Visibility" TargetName="CheckViewBox" Value="Collapsed"/>
                                    <Setter Property="Visibility" TargetName="CheckSquare" Value="Collapsed"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>

            <Trigger Property="Role" Value="SubmenuHeader">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type n:ExtendedMenuItem}">
                            <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" 
                                    Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Uid="Border_42">
                                <Grid x:Name="Grid" Uid="Grid_50">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition SharedSizeGroup="MenuItemIconColumnGroup" MinWidth="24" Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition MinWidth="5" SharedSizeGroup="MenuItemIGTColumnGroup" Width="Auto"/>
                                        <ColumnDefinition Width="14"/>
                                    </Grid.ColumnDefinitions>

                                    <Grid x:Name="CheckSquare" Grid.Column="0" Background="Transparent" Margin="3,0" Visibility="Collapsed">
                                        <Viewbox x:Name="CheckViewBox" Visibility="Collapsed" Stretch="Uniform" Height="{TemplateBinding ContentHeight}" Width="{TemplateBinding ContentWidth}">
                                            <Path x:Name="GlyphPanel" Data="M0,2L0,4.8 2.5,7.4 7.1,2.8 7.1,0 2.5,4.6z" Fill="{TemplateBinding Foreground}" FlowDirection="LeftToRight" 
                                                  Uid="Path_12" Visibility="Hidden" VerticalAlignment="Center"/>
                                        </Viewbox>

                                        <Border x:Name="ImageBorder" Background="{TemplateBinding Icon}" Opacity="{DynamicResource Element.Opacity}" Visibility="Collapsed" 
                                                Height="{TemplateBinding ContentHeight}" Width="{TemplateBinding ContentWidth}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                    </Grid>

                                    <ContentPresenter Grid.Column="1" x:Name="ContentPresenter" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" 
                                                      ContentSource="Header" Margin="3,0" RecognizesAccessKey="True" 
                                                      SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Uid="ContentPresenter_39" VerticalAlignment="Center"/>

                                    <TextBlock x:Name="InputGestureText" Grid.Column="2" Margin="3,0" 
                                               Text="{TemplateBinding InputGestureText}" Uid="TextBlock_10" Foreground="{DynamicResource Element.Foreground.Gray112}" 
                                               FontSize="12" FontWeight="Bold" VerticalAlignment="Center" TextAlignment="Left"/>

                                    <Path x:Name="Path" Grid.Column="3" Data="M0,0L4,3.5 0,7z" Fill="{TemplateBinding Foreground}" Margin="4,0,6,0" Uid="Path_16" VerticalAlignment="Center"/>

                                    <Popup Name="Popup" Grid.Column="3" Placement="Right" IsOpen="{TemplateBinding IsSubmenuOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Fade" VerticalOffset="-2">
                                        <Border Name="SubmenuBorder" SnapsToDevicePixels="True" Background="{DynamicResource Element.Background}" BorderBrush="{DynamicResource Element.Border}"
                                                BorderThickness="1" Effect="{DynamicResource Shadow.Border.Small}" Margin="1">
                                            <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle"/>
                                        </Border>
                                    </Popup>
                                </Grid>
                            </Border>

                            <ControlTemplate.Triggers>
                                <Trigger Property="IsChecked" Value="True">
                                    <Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
                                    <Setter Property="Background" TargetName="CheckSquare" Value="{DynamicResource Element.Background.Hover}"/>
                                </Trigger>
                                <Trigger Property="HasIcon" Value="True">
                                    <Setter Property="Visibility" TargetName="ImageBorder" Value="Visible"/>
                                    <Setter Property="Visibility" TargetName="CheckSquare" Value="Visible"/>
                                </Trigger>
                                <Trigger Property="HasIcon" Value="False">
                                    <Setter Property="Visibility" TargetName="CheckViewBox" Value="Collapsed"/>
                                    <Setter Property="Visibility" TargetName="CheckSquare" Value="Collapsed"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>

            <Trigger Property="IsHighlighted" Value="True">
                <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>
                <Setter Property="Background" Value="{DynamicResource Brush.MenuItem.Background.Hover}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource Brush.MenuItem.Border.Hover}"/>
            </Trigger>

            <Trigger Property="IsPressed" Value="True">
                <Setter Property="Background" Value="{DynamicResource Brush.MenuItem.Background.Pressed}"/>
            </Trigger>

            <!--When !DarkMode, !IsMouseOver, !IsKeyboardFocused-->
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Role" Value="TopLevelHeader"/>
                    <Condition Property="IsOverNonClientArea" Value="True"/>
                    <Condition Property="DarkMode" Value="False"/>
                    <Condition Property="IsMouseOver" Value="False"/>
                    <Condition Property="IsKeyboardFocused" Value="False"/>
                </MultiTrigger.Conditions>

                <Setter Property="Foreground" Value="#FF000000"/>
            </MultiTrigger>

            <!--When DarkMode, !IsMouseOver, !IsKeyboardFocused-->
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Role" Value="TopLevelHeader"/>
                    <Condition Property="IsOverNonClientArea" Value="True"/>
                    <Condition Property="DarkMode" Value="True"/>
                    <Condition Property="IsMouseOver" Value="False"/>
                    <Condition Property="IsKeyboardFocused" Value="False"/>
                </MultiTrigger.Conditions>

                <Setter Property="Foreground" Value="WhiteSmoke"/>
            </MultiTrigger>

            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" Value="0.7"/>
            </Trigger>
        </Style.Triggers>
    </Style>


    <!--SideScrollViewer Style-->
    <Style TargetType="{x:Type n:SideScrollViewer}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:SideScrollViewer}">
                    <Grid x:Name="Grid" Background="{TemplateBinding Background}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>

                        <RepeatButton Grid.Column="0" x:Name="LineLeftButton" IsEnabled="{TemplateBinding IsMouseOver}" Style="{DynamicResource ScrollBar.Button}" Width="15"
                                      Content="M 3.18,7 C3.18,7 5,7 5,7 5,7 1.81,3.5 1.81,3.5 1.81,3.5 5,0 5,0 5,0 3.18,0 3.18,0 3.18,0 0,3.5 0,3.5 0,3.5 3.18,7 3.18,7 z"/>

                        <ScrollContentPresenter Grid.Column="1" x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False"
                                                CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Margin="{TemplateBinding Padding}"/>

                        <Border Grid.Column="1" x:Name="SelectionBorder" Height="3" Width="40" Background="{DynamicResource Element.Selection}" Margin="0,0,0,1"
                                VerticalAlignment="Bottom" HorizontalAlignment="Left" Opacity="0"/>
                        
                        <RepeatButton Grid.Column="2" x:Name="LineRightButton" IsEnabled="{TemplateBinding IsMouseOver}" Style="{DynamicResource ScrollBar.Button}" Width="15"
                                      Content="M 1.81,7 C1.81,7 0,7 0,7 0,7 3.18,3.5 3.18,3.5 3.18,3.5 0,0 0,0 0,0 1.81,0 1.81,0 1.81,0 5,3.5 5,3.5 5,3.5 1.81,7 1.81,7 z"/>
                    </Grid>
                    
                    <ControlTemplate.Triggers>
                        <Trigger Property="DisplayLeftButton" Value="False">
                            <Setter TargetName="LineLeftButton" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="DisplayRightButton" Value="False">
                            <Setter TargetName="LineRightButton" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <!--Ribbon Style-->
    <Style TargetType="{x:Type r:Ribbon}">
        <Setter Property="FontSize" Value="13"/>
        <Setter Property="Background" Value="Transparent"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type r:Ribbon}">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>

                        <!--Tabs-->
                        <!--<TabPanel Grid.Row="0" Grid.Column="0" Name="TabPanel" IsItemsHost="True" Background="Transparent"/>-->
                        <n:SideScrollViewer Grid.Row="0" Grid.Column="0" x:Name="TabPanelScrollViewer" SelectedIndex="{TemplateBinding SelectedIndex}"
                                            VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto" HorizontalAlignment="Stretch">
                            <StackPanel x:Name="TabPanel" IsItemsHost="True" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1" Orientation="Horizontal"/>
                        </n:SideScrollViewer>
                        
                        <!--Right side buttons-->
                        <n:ExtendedToggleButton Grid.Row="0" Grid.Column="1" x:Name="NotificationsButton" MinHeight="26" Text="{DynamicResource S.Notifications}" Style="{DynamicResource Style.ToggleButton.NoBorder}"
                                                ContentHeight="16" ContentWidth="16" BorderThickness="0" Padding="2,2,4,2" TextWrapping="NoWrap" VerticalAlignment="Center"
                                                IsHitTestVisible="{Binding ElementName=MainPopup, Path=IsOpen, Mode=OneWay, Converter={StaticResource InvertedBool}}">
                            <n:ExtendedToggleButton.Resources>
                                <Storyboard x:Key="NotificationStoryboard">
                                    <DoubleAnimation Storyboard.TargetName="NotificationsButton" Storyboard.TargetProperty="Opacity" From="1" To="0.4"
                                                     RepeatBehavior="10x" AutoReverse="True" Duration="0:0:0.6"/>
                                </Storyboard>
                            </n:ExtendedToggleButton.Resources>
                        </n:ExtendedToggleButton>

                        <Popup Grid.Row="0" Grid.Column="1" x:Name="MainPopup" Placement="Bottom" PlacementTarget="{Binding ElementName=NotificationsButton}" 
                               Margin="0" Width="400" Height="Auto" MinHeight="100" MaxHeight="400" SnapsToDevicePixels="True" AllowsTransparency="True"
                               StaysOpen="False" PopupAnimation="Fade" IsOpen="{Binding ElementName=NotificationsButton, Path=IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                            <Popup.HorizontalOffset>
                                <MultiBinding Converter="{StaticResource CenterPopupConverter}">
                                    <Binding RelativeSource="{RelativeSource Self}" Path="PlacementTarget.ActualWidth"/>
                                    <Binding ElementName="NotificationBox" Path="ActualWidth"/>
                                </MultiBinding>
                            </Popup.HorizontalOffset>

                            <n:NotificationBox x:Name="NotificationBox"/>
                        </Popup>

                        <Menu Grid.Row="0" Grid.Column="2" Effect="{x:Null}" Background="Transparent" VerticalAlignment="Center">
                            <n:ExtendedMenuItem x:Name="ExtrasMenuItem" Header="{DynamicResource S.Editor.Extras}" Icon="{DynamicResource Vector.Editor}" ContentHeight="16" ContentWidth="16" BorderThickness="0">
                                <n:ExtendedMenuItem x:Name="OptionsMenuItem" Header="{DynamicResource S.StartUp.Options}" Icon="{DynamicResource Vector.Options}" 
                                                    ContentHeight="16" ContentWidth="16" Command="{TemplateBinding OptionsCommand}"/>
                                <n:ExtendedMenuItem x:Name="FeedbackMenuItem" Header="{DynamicResource S.Feedback.Feedback}" Icon="{DynamicResource Vector.Application}" 
                                                    ContentHeight="16" ContentWidth="16" Command="{TemplateBinding FeedbackCommand}"/>
                                <n:ExtendedMenuItem x:Name="TroubleshootMenuItem" Header="{DynamicResource S.Troubleshoot.Title}" Icon="{DynamicResource Vector.Warning}" 
                                                    ContentHeight="16" ContentWidth="16" Command="{TemplateBinding TroubleshootCommand}"/>
                                <Separator Height="1"/>
                                <n:ExtendedMenuItem x:Name="HelpMenuItem" Header="{DynamicResource S.Editor.Help}" Icon="{DynamicResource Vector.Question}" 
                                                    ContentHeight="16" ContentWidth="16" Command="{TemplateBinding HelpCommand}"/>
                            </n:ExtendedMenuItem>
                        </Menu>

                        <!--Content-->
                        <Border Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" x:Name="ContentBorder" BorderBrush="{DynamicResource Element.Border.LightWeak}" Background="{DynamicResource Panel.Background.Level2}">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>

                                <ContentPresenter Grid.Column="0" Grid.ColumnSpan="2" x:Name="ContentPresenter" ContentSource="SelectedContent"/>

                                <n:ExtendedButton Grid.Row="0" Grid.Column="1" x:Name="HideGridButton" Icon="{DynamicResource Glyph.Up}" 
                                                  HorizontalContentAlignment="Center" VerticalContentAlignment="Center" 
                                                  HorizontalAlignment="Center" VerticalAlignment="Bottom" ContentWidth="16" ContentHeight="16" MinWidth="28"
                                                  Margin="0,0,1,1" Padding="2" Style="{DynamicResource Style.Button.NoText}"/>
                            </Grid>
                        </Border>

                        <!--Bottom shadow-->
                        <Border Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" Effect="{DynamicResource Shadow.Border.Large}" Margin="0,0,0,-3" Height="3">
                            <Border.Background>
                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                    <GradientStop Color="{DynamicResource Gradient.Border.Light}" Offset="0"/>
                                    <GradientStop Color="Transparent" Offset="1"/>
                                </LinearGradientBrush>
                            </Border.Background>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Style.Triggers>
            <Trigger Property="Mode" Value="Menu">
                <Setter Property="Template" Value="{StaticResource Template.Ribbon.Menu}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <!--RibbonTab Style-->
    <Style TargetType="{x:Type r:RibbonTab}">
        <Setter Property="FontSize" Value="13"/>
        <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type r:RibbonTab}">
                    <Grid Name="Panel" Background="Transparent">
                        <Border Name="ContentBorder" BorderBrush="{DynamicResource Element.Foreground.Header}" Background="{TemplateBinding Background}" BorderThickness="0">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition/>
                                </Grid.ColumnDefinitions>

                                <Border Grid.Column="0" x:Name="ImageBorder" Background="{TemplateBinding Icon}" Margin="10,5,0,5"
                                        Height="14" Width="14" VerticalAlignment="Center" HorizontalAlignment="Center" Opacity=".6"/>
                                
                                <!--Header text-->
                                <TextBlock Grid.Column="1" x:Name="HeaderTextBlock" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{TemplateBinding Header}" Margin="5,5,10,6"/>
                                <TextBlock Grid.Column="1" x:Name="FocusedHeaderTextBlock" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{TemplateBinding Header}" Margin="5,5,10,6" 
                                           FontWeight="SemiBold" Visibility="Hidden"/>

                                <!--Accent border-->
                                <Border Grid.Column="0" Grid.ColumnSpan="2" x:Name="SelectionBorder" Height="3" Margin="10,0,10,1" Background="{DynamicResource Element.Selection}" VerticalAlignment="Bottom" Opacity="0"/>
                            </Grid>
                        </Border>
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="Icon" Value="{x:Null}">
                            <Setter TargetName="ImageBorder" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="HeaderTextBlock" Property="Margin" Value="10,5,10,6"/>
                            <Setter TargetName="FocusedHeaderTextBlock" Property="Margin" Value="10,5,10,6"/>
                        </Trigger>

                        <!--MouseHover-->
                        <Trigger SourceName="Panel" Property="IsMouseOver" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:0.2" Storyboard.TargetName="ImageBorder" Storyboard.TargetProperty="Opacity" To="1"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:0.2" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ImageBorder"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>

                            <Setter Property="Background" Value="{DynamicResource Panel.Background.Level2}"/>
                            <Setter TargetName="HeaderTextBlock" Property="Visibility" Value="Hidden"/>
                            <Setter TargetName="FocusedHeaderTextBlock" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        
                        <!--Only works with MultiDataTrigger in here-->
                        <!--Expand the accent border when selected and mouse is hovering-->
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding ElementName=Panel, Path=IsMouseOver, FallbackValue=False}" Value="True"/>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Mode=Self}, Path=IsSelected, FallbackValue=False}" Value="True"/>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Mode=Self}, Path=DisplayAccent, FallbackValue=False}" Value="True"/>
                            </MultiDataTrigger.Conditions>

                            <MultiDataTrigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <ThicknessAnimation Duration="0:0:0:0.15" Storyboard.TargetName="SelectionBorder" Storyboard.TargetProperty="Margin" To="0,0,0,1"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiDataTrigger.EnterActions>
                            <MultiDataTrigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <ThicknessAnimation Duration="0:0:0:0.15" Storyboard.TargetName="SelectionBorder" Storyboard.TargetProperty="Margin"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiDataTrigger.ExitActions>
                        </MultiDataTrigger>

                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Mode=Self}, Path=IsSelected, FallbackValue=False}" Value="True"/>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Mode=Self}, Path=DisplayAccent, FallbackValue=False}" Value="True"/>
                            </MultiDataTrigger.Conditions>

                            <MultiDataTrigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:0:0.15" Storyboard.TargetName="SelectionBorder" Storyboard.TargetProperty="Opacity" To="1"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiDataTrigger.EnterActions>
                            <MultiDataTrigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:0:0.15" Storyboard.TargetName="SelectionBorder" Storyboard.TargetProperty="Opacity"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiDataTrigger.ExitActions>
                        </MultiDataTrigger>
                        
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Background" Value="{DynamicResource Panel.Background.Level2}"/>
                            <Setter TargetName="ImageBorder" Property="Opacity" Value="1"/>

                            <Setter TargetName="HeaderTextBlock" Property="Visibility" Value="Hidden"/>
                            <Setter TargetName="FocusedHeaderTextBlock" Property="Visibility" Value="Visible"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    
    <!--HideableTabControl Style-->
    <Style TargetType="{x:Type n:HideableTabControl}">
        <Setter Property="Background" Value="Transparent"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:HideableTabControl}">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>

                        <n:ExtendedToggleButton Grid.Row="0" Grid.Column="1" x:Name="NotificationsButton" MinHeight="26" Text="{DynamicResource S.Notifications}" Style="{DynamicResource Style.ToggleButton.NoBorder}"
                                                ContentHeight="16" ContentWidth="16" BorderThickness="0" Padding="2,2,4,2" TextWrapping="NoWrap" VerticalAlignment="Center" IsOverNonClientArea="True"
                                                IsHitTestVisible="{Binding ElementName=MainPopup, Path=IsOpen, Mode=OneWay, Converter={StaticResource InvertedBool}}">
                            <n:ExtendedToggleButton.Resources>
                                <Storyboard x:Key="NotificationStoryboard">
                                    <DoubleAnimation Storyboard.TargetName="NotificationsButton" Storyboard.TargetProperty="Opacity" From="1" To="0.4"
                                                     RepeatBehavior="10x" AutoReverse="True" Duration="0:0:0.6"/>
                                </Storyboard>
                            </n:ExtendedToggleButton.Resources>
                        </n:ExtendedToggleButton>

                        <Popup Grid.Row="0" Grid.Column="1" x:Name="MainPopup" Placement="Bottom" PlacementTarget="{Binding ElementName=NotificationsButton}" 
                               Margin="0" Width="400" Height="Auto" MinHeight="100" MaxHeight="400" SnapsToDevicePixels="True" AllowsTransparency="True"
                               StaysOpen="False" PopupAnimation="Fade" IsOpen="{Binding ElementName=NotificationsButton, Path=IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                            <Popup.HorizontalOffset>
                                <MultiBinding Converter="{StaticResource CenterPopupConverter}">
                                    <Binding ElementName="MainPopup" Path="PlacementTarget.ActualWidth"/>
                                    <Binding ElementName="NotificationBox" Path="ActualWidth"/>
                                </MultiBinding>
                            </Popup.HorizontalOffset>
                            
                            <n:NotificationBox x:Name="NotificationBox"/>
                        </Popup>

                        <Menu Grid.Row="0" Grid.Column="2" Effect="{x:Null}" Background="Transparent" VerticalAlignment="Center">
                            <n:ExtendedMenuItem x:Name="ExtrasMenuItem" Header="{DynamicResource S.Editor.Extras}" Icon="{DynamicResource Vector.Editor}" ContentHeight="16" ContentWidth="16" BorderThickness="0">
                                <n:ExtendedMenuItem x:Name="OptionsMenuItem" Header="{DynamicResource S.StartUp.Options}" Icon="{DynamicResource Vector.Options}" 
                                                    ContentHeight="16" ContentWidth="16" Command="{TemplateBinding OptionsCommand}"/>
                                <n:ExtendedMenuItem x:Name="FeedbackMenuItem" Header="{DynamicResource S.Feedback.Feedback}" Icon="{DynamicResource Vector.Application}" 
                                                    ContentHeight="16" ContentWidth="16" Command="{TemplateBinding FeedbackCommand}"/>
                                <n:ExtendedMenuItem x:Name="TroubleshootMenuItem" Header="{DynamicResource S.Troubleshoot.Title}" Icon="{DynamicResource Vector.Warning}" 
                                                    ContentHeight="16" ContentWidth="16" Command="{TemplateBinding TroubleshootCommand}"/>
                                
                                <Separator Height="1"/>
                                
                                <n:ExtendedMenuItem x:Name="HelpMenuItem" Header="{DynamicResource S.Editor.Help}" Icon="{DynamicResource Vector.Question}" 
                                                    ContentHeight="16" ContentWidth="16" Command="{TemplateBinding HelpCommand}"/>
                            </n:ExtendedMenuItem>
                        </Menu>

                        <Border Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" x:Name="ContentBorder" BorderBrush="{DynamicResource Element.Border.Light}" BorderThickness="0,1" Background="{DynamicResource Panel.Background.Level2}">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>

                                <ContentPresenter Grid.Column="0" Grid.ColumnSpan="2" ContentSource="SelectedContent"/>

                                <n:ExtendedButton Grid.Row="0" Grid.Column="1" x:Name="HideGridButton" Icon="{DynamicResource Glyph.Up}" 
                                                  HorizontalContentAlignment="Center" VerticalContentAlignment="Center" 
                                                  HorizontalAlignment="Center" VerticalAlignment="Bottom" ContentWidth="16" ContentHeight="16" MinWidth="28"
                                                  Margin="0,0,1,1" Padding="2" Style="{DynamicResource Style.Button.NoText}"/>
                            </Grid>
                        </Border>

                        <TabPanel Grid.Row="0" Grid.Column="0" Name="TabPanel" Margin="5,5,0,-2" IsItemsHost="True" Background="Transparent"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--AwareTabItem Style-->
    <Style TargetType="{x:Type n:AwareTabItem}">
        <Setter Property="FontFamily" Value="Segoe UI Semilight"/>
        <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:AwareTabItem}">
                    <Grid Name="Panel" Background="Transparent">
                        <Border Name="ContentBorder" BorderBrush="{DynamicResource Element.Border.Light}" Background="{TemplateBinding Background}" BorderThickness="0">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition/>
                                </Grid.ColumnDefinitions>

                                <Border Grid.Column="0" x:Name="ImageBorder" Background="{TemplateBinding Icon}" Margin="10,2,2,2"
                                        Height="14" Width="14" VerticalAlignment="Center" HorizontalAlignment="Center" Opacity=".6"/>

                                <ContentPresenter Grid.Column="1" x:Name="ContentSite" VerticalAlignment="Center" Effect="{x:Null}" 
                                                  HorizontalAlignment="Center" ContentSource="Header" Margin="2,2,10,2"/>
                            </Grid>
                        </Border>
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger SourceName="ImageBorder" Property="Visibility" Value="Collapsed">
                            <Setter TargetName="ContentSite" Property="Margin" Value="10,2"/>
                        </Trigger>

                        <Trigger Property="Icon" Value="{x:Null}">
                            <Setter TargetName="ImageBorder" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="ContentSite" Property="Margin" Value="10,2"/>
                        </Trigger>

                        <DataTrigger Binding="{Binding Path=IsMouseOver, ElementName=Panel}" Value="True">
                            <DataTrigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:0.2" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ImageBorder" To="1"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </DataTrigger.EnterActions>
                            <DataTrigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:0.2" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ImageBorder"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </DataTrigger.ExitActions>

                            <Setter Property="Foreground" Value="{DynamicResource Element.Foreground.Header}"/>
                            <Setter Property="Background" Value="{DynamicResource Element.Background.Hover}"/>
                        </DataTrigger>

                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Foreground" Value="{DynamicResource Element.Foreground.Header}"/>
                            <Setter Property="Background" Value="{DynamicResource Panel.Background.Level2}"/>
                            <Setter TargetName="ContentBorder" Property="BorderThickness" Value="1,1,1,0"/>
                            <Setter TargetName="ImageBorder" Property="Opacity" Value="1"/>
                        </Trigger>

                        <!--When ExtendChrome, !IsDark, !IsSelected-->
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding Source={x:Static t:UserSettings.All}, Path=EditorExtendChrome, FallbackValue=False}" Value="True"/>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsDark}" Value="False"/>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsSelected}" Value="False"/>
                            </MultiDataTrigger.Conditions>

                            <Setter Property="Foreground" Value="#FF000000"/>
                            <Setter TargetName="ContentBorder" Property="Background" Value="#90FFFFFF"/>
                        </MultiDataTrigger>

                        <!--When ExtendChrome, !IsDark, IsMouseOver-->
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding Source={x:Static t:UserSettings.All}, Path=EditorExtendChrome, FallbackValue=False}" Value="True"/>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsDark}" Value="False"/>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsMouseOver}" Value="True"/>
                            </MultiDataTrigger.Conditions>

                            <Setter Property="Foreground" Value="{DynamicResource Element.Foreground.Header}"/>
                        </MultiDataTrigger>

                        <!--When ExtendChrome, !IsDark, IsSelected-->
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding Source={x:Static t:UserSettings.All}, Path=EditorExtendChrome, FallbackValue=False}" Value="True"/>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsDark}" Value="False"/>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsSelected}" Value="True"/>
                            </MultiDataTrigger.Conditions>

                            <Setter TargetName="Panel" Property="Background" Value="{DynamicResource Panel.Background.Level2}"/>
                            <Setter Property="Foreground" Value="{DynamicResource Element.Foreground.Header}"/>
                            <Setter TargetName="ContentBorder" Property="BorderThickness" Value="1,1,1,0"/>
                        </MultiDataTrigger>

                        <!--When ExtendChrome, IsDark, !IsSelected-->
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding Source={x:Static t:UserSettings.All}, Path=EditorExtendChrome, FallbackValue=False}" Value="True"/>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsDark}" Value="True"/>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsSelected}" Value="False"/>
                            </MultiDataTrigger.Conditions>

                            <Setter Property="Foreground" Value="#FFF8F8FF"/>

                            <Setter TargetName="ContentBorder" Property="Background">
                                <Setter.Value>
                                    <RadialGradientBrush>
                                        <GradientStop Color="{Binding Source={x:Static SystemParameters.WindowGlassColor}, 
                                                      Converter={StaticResource ColorToAlphaConverter}, ConverterParameter=6E}" Offset="0"/>
                                        <GradientStop Color="{Binding Source={x:Static SystemParameters.WindowGlassColor}, 
                                                      Converter={StaticResource ColorToAlphaConverter}, ConverterParameter=50}" Offset="0.4"/>
                                        <GradientStop Offset="1"/>
                                    </RadialGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </MultiDataTrigger>

                        <!--When ExtendChrome, IsDark, IsMouseOver-->
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding Source={x:Static t:UserSettings.All}, Path=EditorExtendChrome, FallbackValue=False}" Value="True"/>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsDark}" Value="True"/>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsMouseOver}" Value="True"/>
                            </MultiDataTrigger.Conditions>

                            <Setter Property="Foreground" Value="#FFBFEFFF"/>
                        </MultiDataTrigger>

                        <!--When ExtendChrome, IsDark, IsSelected-->
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding Source={x:Static t:UserSettings.All}, Path=EditorExtendChrome, FallbackValue=False}" Value="True"/>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsDark}" Value="True"/>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsSelected}" Value="True"/>
                            </MultiDataTrigger.Conditions>

                            <Setter TargetName="Panel" Property="Background" Value="{DynamicResource Panel.Background.Level2}"/>
                            <Setter Property="Foreground" Value="{DynamicResource Element.Foreground.Header}"/>
                            <Setter TargetName="ContentBorder" Property="BorderThickness" Value="1,1,1,0"/>
                        </MultiDataTrigger>

                        <!--When !ShowBackground, !IsSelected-->
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=ShowBackground}" Value="False"/>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsSelected}" Value="False"/>
                            </MultiDataTrigger.Conditions>

                            <Setter TargetName="ContentBorder" Property="Background" Value="Transparent"/>
                        </MultiDataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    
    <!--StatusBand Style-->
    <Style TargetType="{x:Type n:StatusBand}">
        <Setter Property="Visibility" Value="Collapsed"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:StatusBand}">
                    <Grid x:Name="WarningGrid" Height="Auto" MinHeight="30">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="30"/>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="30"/>
                        </Grid.ColumnDefinitions>

                        <Grid.Resources>
                            <Storyboard x:Key="HideWarningStoryboard">
                                <DoubleAnimation Storyboard.TargetProperty="(Grid.Opacity)" From="{Binding ElementName=WarningGrid,Path=Opacity}" To="0" Duration="0:0:0.5">
                                    <DoubleAnimation.EasingFunction>
                                        <PowerEase Power="8"/>
                                    </DoubleAnimation.EasingFunction>
                                </DoubleAnimation>

                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Grid.Visibility)" Duration="0:0:0.5">
                                    <DiscreteObjectKeyFrame Value="{x:Static Visibility.Collapsed}" KeyTime="0:0:0.2"/>
                                </ObjectAnimationUsingKeyFrames>

                                <BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="(Grid.IsHitTestVisible)" Duration="0:0:0.0">
                                    <DiscreteBooleanKeyFrame Value="False" KeyTime="0:0:0.0"/>
                                </BooleanAnimationUsingKeyFrames>
                            </Storyboard>

                            <!--Storyboard.TargetName="WarningGrid" -->
                            <Storyboard x:Key="ShowWarningStoryboard">
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Grid.Visibility)" Duration="0:0:0" >
                                    <DiscreteObjectKeyFrame Value="{x:Static Visibility.Visible}" KeyTime="0:0:0"/>
                                </ObjectAnimationUsingKeyFrames>

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

                                <BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="(Grid.IsHitTestVisible)" Duration="0:0:0.0">
                                    <DiscreteBooleanKeyFrame Value="True" KeyTime="0:0:0.0"/>
                                </BooleanAnimationUsingKeyFrames>
                            </Storyboard>
                        </Grid.Resources>

                        <Border Grid.Column="0" x:Name="WarningBorder" Background="{DynamicResource Vector.Info}" Margin="3" Opacity="{DynamicResource Element.Opacity}"/>
                        
                        <TextBlock Grid.Column="1" x:Name="WarningTextBlock" Text="{TemplateBinding Text}" FontSize="12" 
                                   Foreground="{DynamicResource Element.Foreground}" VerticalAlignment="Center" TextWrapping="WrapWithOverflow" Margin="5,0,5,0"/>

                        <TextBlock Grid.Column="1" x:Name="LinkTextBlock" FontSize="12" VerticalAlignment="Center" TextWrapping="WrapWithOverflow" Margin="5,0,5,0" Visibility="Collapsed">
                            <Hyperlink x:Name="MainHyperlink">
                                <Run Text="{TemplateBinding Text}"/>
                            </Hyperlink>
                        </TextBlock>

                        <n:ExtendedButton Grid.Column="2" x:Name="SuppressButton" Icon="{DynamicResource Vector.Close}" ContentWidth="16" ContentHeight="16"
                                          HorizontalContentAlignment="Center" HorizontalAlignment="Center" Style="{DynamicResource Style.Button.NoText}" MinWidth="30"
                                          ToolTip="{DynamicResource S.Suppress}" ToolTipService.Placement="Top" ToolTipService.HorizontalOffset="-5">
                            <!--<n:ExtendedButton.Triggers>
                                <EventTrigger RoutedEvent="Button.Click">
                                    <EventTrigger.Actions>
                                        <BeginStoryboard Storyboard="{StaticResource HideWarningStoryboard}" Storyboard.TargetName="WarningGrid" HandoffBehavior="SnapshotAndReplace"/>
                                    </EventTrigger.Actions>
                                </EventTrigger>
                            </n:ExtendedButton.Triggers>-->
                        </n:ExtendedButton>
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="Type" Value="Update">
                            <Setter TargetName="WarningGrid" Property="Background" Value="{DynamicResource Brush.StatusBand.Info}"/>
                            <Setter TargetName="WarningBorder" Property="Background" Value="{DynamicResource Vector.Synchronize}"/>
                        </Trigger>
                        <Trigger Property="Type" Value="Info">
                            <Setter TargetName="WarningGrid" Property="Background" Value="{DynamicResource Brush.StatusBand.Info}"/>
                            <Setter TargetName="WarningBorder" Property="Background" Value="{DynamicResource Vector.Info}"/>
                        </Trigger>
                        <Trigger Property="Type" Value="Warning">
                            <Setter TargetName="WarningGrid" Property="Background" Value="{DynamicResource Brush.StatusBand.Warning}"/>
                            <Setter TargetName="WarningBorder" Property="Background" Value="{DynamicResource Vector.Warning}"/>
                        </Trigger>
                        <Trigger Property="Type" Value="Error">
                            <Setter TargetName="WarningGrid" Property="Background" Value="{DynamicResource Brush.StatusBand.Error}"/>
                            <Setter TargetName="WarningBorder" Property="Background" Value="{DynamicResource Vector.Cancel.Round}"/>
                        </Trigger>
                        <Trigger Property="IsLink" Value="True">
                            <Setter TargetName="LinkTextBlock" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="WarningTextBlock" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--ExtendedCheckBox Style-->
    <Style TargetType="{x:Type n:ExtendedCheckBox}">
        <Setter Property="Background" Value="{DynamicResource Element.Background}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource Element.Border}"/>
        <Setter Property="Foreground" Value="{DynamicResource Element.Foreground.Medium}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Padding" Value="4,0,0,0"/>
        <Setter Property="FocusVisualStyle" Value="{DynamicResource Style.FocusVisual.NoMargin}"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:ExtendedCheckBox}">
                    <Grid x:Name="templateRoot" Background="Transparent">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>

                        <Border x:Name="checkBoxBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" 
                                Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                Margin="1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <Grid x:Name="markGrid">
                                <Path x:Name="optionMark" Data="F1 M 9.97498,.8 L 4.6983,9.09834  L 1,5.19331 L 1.27664,3.52165 L 4.255,6.08833 L 9.33331,1.288e-005 Z" Fill="{DynamicResource Element.Glyph}" Margin="1" Opacity="0" Stretch="None"/>
                                <Rectangle x:Name="indeterminateMark" Fill="{DynamicResource Element.Glyph}" Margin="2" Opacity="0"/>
                            </Grid>
                        </Border>

                        <TextBlock Grid.Column="1" x:Name="MainTextBlock" Focusable="False" TextWrapping="{TemplateBinding TextWrapping}" Margin="{TemplateBinding Padding}"
                                   HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Padding="0,-1,0,0">
                            <Run Text="{TemplateBinding Text}"/>
                            <Run x:Name="MarginRun" Text=" "/>
                            <Run Text="{TemplateBinding Info}" Foreground="{DynamicResource Element.Foreground.Gray150}"/>
                        </TextBlock>
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="HasContent" Value="True">
                            <Setter Property="FocusVisualStyle">
                                <Setter.Value>
                                    <Style>
                                        <Setter Property="Control.Template">
                                            <Setter.Value>
                                                <ControlTemplate>
                                                    <Rectangle Margin="14,0,0,0" SnapsToDevicePixels="True" Stroke="{DynamicResource Element.Foreground}" StrokeThickness="1" StrokeDashArray="1 2"/>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </Setter.Value>
                            </Setter>

                            <Setter Property="Padding" Value="4,-1,0,0"/>
                        </Trigger>
                        
                        <Trigger Property="Text" Value="{x:Null}">
                            <Setter TargetName="MarginRun" Property="Text" Value=""/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" TargetName="checkBoxBorder" Value="{DynamicResource Element.Background.Hover}"/>
                            <Setter Property="BorderBrush" TargetName="checkBoxBorder" Value="{DynamicResource Element.Border.Hover}"/>
                            <Setter Property="Fill" TargetName="optionMark" Value="{DynamicResource Element.Glyph.Hover}"/>
                            <Setter Property="Fill" TargetName="indeterminateMark" Value="{DynamicResource Element.Glyph.Hover}"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="Background" TargetName="checkBoxBorder" Value="{DynamicResource Element.Background.Pressed}"/>
                            <Setter Property="BorderBrush" TargetName="checkBoxBorder" Value="{DynamicResource Element.Border.Pressed}"/>
                            <Setter Property="Fill" TargetName="optionMark" Value="{DynamicResource Element.Glyph.Pressed}"/>
                            <Setter Property="Fill" TargetName="indeterminateMark" Value="{DynamicResource Element.Glyph.Pressed}"/>
                        </Trigger>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter Property="Opacity" TargetName="optionMark" Value="1"/>
                            <Setter Property="Opacity" TargetName="indeterminateMark" Value="0"/>
                        </Trigger>
                        <Trigger Property="IsChecked" Value="{x:Null}">
                            <Setter Property="Opacity" TargetName="optionMark" Value="0"/>
                            <Setter Property="Opacity" TargetName="indeterminateMark" Value="1"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Opacity" Value="0.7"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--LabelSeparator Style-->
    <Style TargetType="{x:Type n:LabelSeparator}">
        <Setter Property="Height" Value="Auto"/>
        <Setter Property="Padding" Value="3"/>
        <Setter Property="Background" Value="{DynamicResource Element.Border.Light}"/>
        <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="UseLayoutRounding" Value="True"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:LabelSeparator}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition x:Name="LeftColumn" Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition x:Name="RightColumn" Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>

                        <Rectangle Grid.Column="0" x:Name="LeftRectangle" Height="1" Fill="{TemplateBinding Background}" VerticalAlignment="Center" Margin="0,0,2,0"/>
                        <TextBlock Grid.Column="1" Text="{TemplateBinding Text}" Padding="{TemplateBinding Padding}" Foreground="{TemplateBinding Foreground}"
                                   VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        <Rectangle Grid.Column="2" x:Name="RightRectangle" Height="1" Fill="{TemplateBinding Background}" VerticalAlignment="Center" Margin="2,0,0,0"/>
                        <TextBlock Grid.Column="3" x:Name="RightTextBlock" Text="{TemplateBinding TextRight}" Padding="{TemplateBinding Padding}" 
                                   Foreground="{TemplateBinding Foreground}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="TextRight" Value="{x:Static s:String.Empty}">
                            <Setter TargetName="RightTextBlock" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="TextRight" Value="{x:Null}">
                            <Setter TargetName="RightTextBlock" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="TextAlignment" Value="Left">
                            <Setter TargetName="LeftColumn" Property="Width" Value="0"/>
                            <Setter TargetName="LeftRectangle" Property="Margin" Value="0"/>
                            <Setter TargetName="LeftRectangle" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="TextAlignment" Value="Right">
                            <Setter TargetName="RightColumn" Property="Width" Value="0"/>
                            <Setter TargetName="RightRectangle" Property="Margin" Value="0"/>
                            <Setter TargetName="RightRectangle" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--ColorBox Style-->
    <Style TargetType="{x:Type n:ColorBox}">
        <Setter Property="Height" Value="26"/>
        <Setter Property="MinWidth" Value="70"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="Cursor" Value="Hand"/>
        <Setter Property="BorderBrush" Value="{DynamicResource Element.Border}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="ToolTip" Value="{DynamicResource S.SelectColor}"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:ColorBox}">
                    <Border x:Name="MainBorder" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}"
                            Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" MaxHeight="{TemplateBinding MaxHeight}" MaxWidth="{TemplateBinding MaxWidth}">
                        <Border.Background>
                            <DrawingBrush Viewport="0,0,10,10" ViewportUnits="Absolute" TileMode="Tile">
                                <DrawingBrush.Drawing>
                                    <DrawingGroup>
                                        <GeometryDrawing Brush="White">
                                            <GeometryDrawing.Geometry>
                                                <RectangleGeometry Rect="0,0 100,100"/>
                                            </GeometryDrawing.Geometry>
                                        </GeometryDrawing>
                                        <GeometryDrawing Brush="LightGray">
                                            <GeometryDrawing.Geometry>
                                                <GeometryGroup>
                                                    <RectangleGeometry Rect="0,0 50,50"/>
                                                    <RectangleGeometry Rect="50,50 50,50"/>
                                                </GeometryGroup>
                                            </GeometryDrawing.Geometry>
                                        </GeometryDrawing>
                                    </DrawingGroup>
                                </DrawingBrush.Drawing>
                            </DrawingBrush>
                        </Border.Background>

                        <Border BorderThickness="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" 
                                Background="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedColor, Converter={StaticResource ColorToBrush}}"/>
                    </Border>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="BorderBrush" Value="{DynamicResource Element.Border.Hover}"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="BorderBrush" Value="{DynamicResource Element.Border.Pressed}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="IsHitTestVisible" Value="False"/>
                            <Setter Property="Opacity" Value="0.8"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--CircularProgressBar Style-->
    <Style TargetType="{x:Type n:CircularProgressBar}">
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="HorizontalAlignment" Value="Center"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:CircularProgressBar}">
                    <Path x:Name="PathRoot" Stroke="{TemplateBinding SegmentColor}" StrokeThickness="{TemplateBinding StrokeThickness}" HorizontalAlignment="Left" VerticalAlignment="Top">
                        <Path.Data>
                            <PathGeometry>
                                <PathGeometry.Figures>
                                    <PathFigureCollection>
                                        <PathFigure x:Name="PathFigure">
                                            <PathFigure.Segments>
                                                <PathSegmentCollection>
                                                    <ArcSegment x:Name="ArcSegment" SweepDirection="Clockwise"/>
                                                </PathSegmentCollection>
                                            </PathFigure.Segments>
                                        </PathFigure>
                                    </PathFigureCollection>
                                </PathGeometry.Figures>
                            </PathGeometry>
                        </Path.Data>
                    </Path>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" Value=".7"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    
    <!--ZoomControl Style-->
    <Style TargetType="{x:Type n:ZoomBox}">
        <Setter Property="ClipToBounds" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:ZoomBox}">
                    <ScrollViewer x:Name="ScrollViewer" ClipToBounds="True" Background="Transparent" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" >
                        <Grid x:Name="Grid" RenderTransformOrigin="0.5,0.5" Background="Transparent" HorizontalAlignment="Center" VerticalAlignment="Center">
                            <Grid.LayoutTransform>
                                <TransformGroup>
                                    <ScaleTransform x:Name="ScaleTransform"/>
                                </TransformGroup>
                            </Grid.LayoutTransform>

                            <Viewbox Grid.Column="0" Grid.Row="0">
                                <Image x:Name="ImageControl" RenderOptions.BitmapScalingMode="NearestNeighbor" Source="{TemplateBinding ImageSource, Converter={StaticResource UriToBitmapConverter}}"/>
                            </Viewbox>
                        </Grid>
                    </ScrollViewer>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--FrameViewer Style-->
    <Style TargetType="{x:Type n:FrameViewer}">
        <Setter Property="ClipToBounds" Value="True"/>
        
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:FrameViewer}">
                    <ScrollViewer x:Name="ScrollViewer" ClipToBounds="True" Background="Transparent" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" >
                        <Grid x:Name="Grid" RenderTransformOrigin="0.5,0.5" Background="Transparent" HorizontalAlignment="Center" VerticalAlignment="Center">
                            <Grid.LayoutTransform>
                                <TransformGroup>
                                    <ScaleTransform x:Name="ScaleTransform"/>
                                </TransformGroup>
                            </Grid.LayoutTransform>

                            <Viewbox>
                                <Image x:Name="ImageControl" RenderOptions.BitmapScalingMode="NearestNeighbor" Source="{TemplateBinding Source}"/>
                            </Viewbox>
                        </Grid>
                    </ScrollViewer>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    

    <!--SpectrumSlider Styles -->
    <Style x:Key="Style.RepeatButton.Slider" TargetType="{x:Type RepeatButton}">
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Background" Value="Transparent"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border Background="{TemplateBinding Background}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="{x:Type n:ColorThumb}" TargetType="{x:Type n:ColorThumb}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Viewbox>
                        <Grid Background="Transparent" Cursor="Hand">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="4*"/>
                                <ColumnDefinition Width="6*" MinWidth="10"/>
                                <ColumnDefinition Width="4*"/>
                            </Grid.ColumnDefinitions>

                            <Polygon Grid.Column="0" x:Name="LeftPolygon" Fill="{DynamicResource Element.Background}" Stroke="{DynamicResource Element.Border}" 
                                     StrokeThickness="0.5" Points="0.5,0  5.5,4.5  0.5,9" UseLayoutRounding="True" SnapsToDevicePixels="True"/>
                            <Polygon Grid.Column="2" x:Name="RightPolygon" Fill="{DynamicResource Element.Background}" Stroke="{DynamicResource Element.Border}" 
                                     StrokeThickness="0.5" Points="5.5,0  0.5,4.5  5.5,9" UseLayoutRounding="True" SnapsToDevicePixels="True"/>
                        </Grid>
                    </Viewbox>
                    
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="LeftPolygon" Property="Fill" Value="{DynamicResource Element.Background.Hover}"/>
                            <Setter TargetName="RightPolygon" Property="Fill" Value="{DynamicResource Element.Background.Hover}"/>
                            <Setter TargetName="LeftPolygon" Property="Stroke" Value="{DynamicResource Element.Border.Hover}"/>
                            <Setter TargetName="RightPolygon" Property="Stroke" Value="{DynamicResource Element.Border.Hover}"/>
                        </Trigger>
                        <Trigger Property="IsDragging" Value="True">
                            <Setter TargetName="LeftPolygon" Property="Fill" Value="{DynamicResource Element.Background.Pressed}"/>
                            <Setter TargetName="RightPolygon" Property="Fill" Value="{DynamicResource Element.Background.Pressed}"/>
                            <Setter TargetName="LeftPolygon" Property="Stroke" Value="{DynamicResource Element.Border.Pressed}"/>
                            <Setter TargetName="RightPolygon" Property="Stroke" Value="{DynamicResource Element.Border.Pressed}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="{x:Type n:SpectrumSlider}" TargetType="{x:Type n:SpectrumSlider}">
        <Setter Property="Orientation" Value="Vertical"/>
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"/>
        <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>
        <Setter Property="Minimum" Value="0"/>
        <Setter Property="Maximum" Value="100"/>
        <Setter Property="TickFrequency" Value="0.001"/>
        <Setter Property="IsSnapToTickEnabled" Value="True"/>
        <Setter Property="IsDirectionReversed" Value="False"/>
        <Setter Property="Value" Value="1"/>
        <Setter Property="Background">
            <Setter.Value>
                <DrawingBrush Viewport="0,0,10,10" ViewportUnits="Absolute" TileMode="Tile">
                    <DrawingBrush.Drawing>
                        <DrawingGroup>
                            <GeometryDrawing Brush="White">
                                <GeometryDrawing.Geometry>
                                    <RectangleGeometry Rect="0,0 100,100"/>
                                </GeometryDrawing.Geometry>
                            </GeometryDrawing>
                            <GeometryDrawing Brush="LightGray">
                                <GeometryDrawing.Geometry>
                                    <GeometryGroup>
                                        <RectangleGeometry Rect="0,0 50,50"/>
                                        <RectangleGeometry Rect="50,50 50,50"/>
                                    </GeometryGroup>
                                </GeometryDrawing.Geometry>
                            </GeometryDrawing>
                        </DrawingGroup>
                    </DrawingBrush.Drawing>
                </DrawingBrush>
            </Setter.Value>
        </Setter>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:SpectrumSlider}">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Height="{TemplateBinding Height}">
                        <Grid MinWidth="{TemplateBinding Slider.MinWidth}" ClipToBounds="False" Effect="{DynamicResource Shadow.Border.Large}">
                            <!--Spectrum-->
                            <Border x:Name="TrackBackground" Width="Auto">
                                <Rectangle x:Name="PART_SpectrumDisplay" Stretch="Fill" VerticalAlignment="Stretch"/>
                            </Border>

                            <!--Selection Range-->
                            <Canvas HorizontalAlignment="Center" Width="4">
                                <Rectangle x:Name="PART_SelectionRange" Canvas.Left="1" Fill="{DynamicResource Element.Foreground}" Width="2.0" Visibility="Hidden"/>
                            </Canvas>

                            <Track Name="PART_Track">
                                <Track.DecreaseRepeatButton>
                                    <RepeatButton x:Name="DecreaseRepeatButton" Style="{StaticResource Style.RepeatButton.Slider}" Command="Slider.DecreaseLarge"/>
                                </Track.DecreaseRepeatButton>
                                <Track.IncreaseRepeatButton>
                                    <RepeatButton x:Name="IncreaseRepeatButton" Style="{StaticResource Style.RepeatButton.Slider}" Command="Slider.IncreaseLarge"/>
                                </Track.IncreaseRepeatButton>
                                <Track.Thumb>
                                    <n:ColorThumb x:Name="Thumb" Height="Auto" ThumbColor="{Binding SelectedColor, RelativeSource={RelativeSource TemplatedParent}}" Margin="-1,-10"/>
                                </Track.Thumb>
                            </Track>
                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>
                        <!-- Display SelectionRange background -->
                        <Trigger Property="IsSelectionRangeEnabled" Value="True">
                            <Setter TargetName="PART_SelectionRange" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="Width" Value="Auto">
                            <Setter Property="MinWidth" Value="21"/>
                        </Trigger>
                        <Trigger Property="Height" Value="Auto">
                            <Setter Property="MinHeight" Value="104"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--RangeSlider Styles-->
    <Style x:Key="Style.Slider.Special" TargetType="Slider">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Slider">
                    <Grid x:Name="Root">
                        <Grid x:Name="HorizontalTemplate">
                            <Track x:Name="PART_Track">
                                <Track.IncreaseRepeatButton>
                                    <RepeatButton x:Name="HorizontalTrackLargeChangeIncreaseRepeatButton" Template="{StaticResource Template.RepeatButton.Simple}" IsTabStop="False"/>
                                </Track.IncreaseRepeatButton>
                                <Track.DecreaseRepeatButton>
                                    <RepeatButton x:Name="HorizontalTrackLargeChangeDecreaseRepeatButton" Template="{StaticResource Template.RepeatButton.Simple}" IsTabStop="False"/>
                                </Track.DecreaseRepeatButton>

                                <Track.Thumb>
                                    <Thumb x:Name="HorizontalThumb" Height="18" Width="10" Template="{StaticResource Template.Slider.Thumb.Horizontal}" IsTabStop="False"/>
                                </Track.Thumb>
                            </Track>
                        </Grid>
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="TickPlacement" Value="BottomRight">
                            <Setter TargetName="HorizontalThumb" Property="Template" Value="{StaticResource Template.Slider.Thumb.Bottom}"/>
                        </Trigger>
                        <Trigger Property="TickPlacement" Value="TopLeft">
                            <Setter TargetName="HorizontalThumb" Property="Template" Value="{StaticResource Template.Slider.Thumb.Top}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type n:RangeSlider}">
        <Setter Property="TickPlacement" Value="BottomRight"/>
        <Setter Property="Background" Value="{DynamicResource Element.Background}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource Element.Border}"/>
        
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:RangeSlider}">
                    <Grid x:Name="LayoutRoot">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>

                        <TickBar x:Name="TopTick" Grid.Row="0" Fill="{DynamicResource Element.Border}" TickFrequency="1" Height="4" Margin="5,0,5,2" Placement="Top" Visibility="Collapsed"/>
                        <TickBar x:Name="BottomTick" Grid.Row="2" Fill="{DynamicResource Element.Border}" TickFrequency="1" Height="4" Margin="5,1,5,0" Placement="Bottom" Visibility="Collapsed"/>

                        <Border x:Name="TrackBorder" Grid.Row="1" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" Height="3" VerticalAlignment="Center" Margin="4,0"/>
                        <Border x:Name="ProgressBorder" Grid.Row="1" Background="{DynamicResource Element.Border.Hover}" BorderThickness="0" Height="3" VerticalAlignment="Center"/>

                        <Slider x:Name="LowerSlider" Grid.Row="1" IsTabStop="False"
                                Minimum="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Minimum, Mode=TwoWay}"
                                Maximum="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Maximum, Mode=TwoWay}"
                                Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=LowerValue, Mode=TwoWay}"
                                TickPlacement="{TemplateBinding TickPlacement}" AutoToolTipPlacement="TopLeft" Style="{StaticResource Style.Slider.Special}"/>

                        <Slider x:Name="UpperSlider" Grid.Row="1" IsTabStop="False"
                                Minimum="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Minimum, Mode=TwoWay}"
                                Maximum="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Maximum, Mode=TwoWay}"
                                Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=UpperValue, Mode=TwoWay}"
                                TickPlacement="{TemplateBinding TickPlacement}" AutoToolTipPlacement="TopLeft" Style="{StaticResource Style.Slider.Special}"/>
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="TickPlacement" Value="TopLeft">
                            <Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
                            <Setter Property="Margin" TargetName="ProgressBorder" Value="0,3,0,0"/>
                        </Trigger>
                        <Trigger Property="TickPlacement" Value="BottomRight">
                            <Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
                            <Setter Property="Margin" TargetName="ProgressBorder" Value="0,0,0,3"/>
                        </Trigger>
                        <Trigger Property="TickPlacement" Value="Both">
                            <Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
                            <Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Opacity" TargetName="ProgressBorder" Value="0.7"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--Card Style-->
    <Style TargetType="{x:Type n:Card}">
        <Setter Property="MinHeight" Value="40"/>
        <Setter Property="Width" Value="190"/>
        <Setter Property="Margin" Value="2"/>
        <Setter Property="Background" Value="#20FFFFFF"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Padding" Value="1"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="Cursor" Value="Hand"/>
        <Setter Property="Icon" Value="{DynamicResource Vector.Add}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource Element.Border}"/>
        <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:Card}">
                    <Border x:Name="MainBorder" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
                        <Grid x:Name="MainGrid">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="32"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>

                            <TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" x:Name="HeaderTextBlock" Margin="2,0" Padding="1"
                                       Text="{TemplateBinding Header}" HorizontalAlignment="Center" VerticalAlignment="Center"
                                       FontSize="12" Foreground="{TemplateBinding Foreground}"/>

                            <Border Grid.Row="1" Grid.Column="0" Background="{TemplateBinding Icon}" Margin="5" Opacity="{DynamicResource Element.Opacity}" Height="20" Width="20"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>

                            <TextBlock Grid.Row="1" Grid.Column="1" x:Name="DescriptionTexBlock" Text="{TemplateBinding Description}" 
                                       Foreground="{TemplateBinding Foreground}" TextWrapping="WrapWithOverflow" Focusable="False" 
                                       HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="5,0,0,0"
                                       Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>

                            <ProgressBar Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" x:Name="MainProgressBar" VerticalAlignment="Bottom" Height="5" 
                                         Visibility="Collapsed" Maximum="100" IsIndeterminate="True" BorderThickness="0"/>
                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" TargetName="MainBorder" Value="{DynamicResource Element.Background.Hover}"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="Background" TargetName="MainBorder" Value="{DynamicResource Element.Background.Pressed}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="IsHitTestVisible" Value="False"/>
                            <Setter Property="Opacity" Value="0.7"/>
                        </Trigger>

                        <Trigger Property="Status" Value="Processing">
                            <Setter Property="IsHitTestVisible" Value="False"/>
                        </Trigger>

                        <Trigger Property="Status" Value="Available">
                            <Setter Property="Icon" Value="{DynamicResource Vector.Add}"/>
                        </Trigger>

                        <Trigger Property="Status" Value="Processing">
                            <Setter Property="IsHitTestVisible" Value="False"/>
                            <Setter TargetName="MainProgressBar" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="MainProgressBar" Property="IsIndeterminate" Value="True"/>
                        </Trigger>

                        <Trigger Property="Status" Value="Ready">
                            <Setter Property="Icon" Value="{DynamicResource Vector.Ok.Round}"/>
                            <Setter Property="ToolTip" Value="{DynamicResource Extras.Ready.Info}"/>
                        </Trigger>

                        <Trigger Property="Status" Value="Error">
                            <Setter Property="Background" TargetName="MainGrid" Value="#10F24D4D"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--ExtendedListBoxItem Style (Language List)-->
    <Style TargetType="{x:Type n:ExtendedListBoxItem}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Padding" Value="4,1"/>
        <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="FocusVisualStyle" Value="{DynamicResource Style.FocusVisual.NoMargin}"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:ExtendedListBoxItem}">
                    <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True">
                        <Grid ToolTip="{TemplateBinding Tag}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>

                            <Border Grid.Column="0" Background="{TemplateBinding Icon}" Opacity="{DynamicResource Element.Opacity}" Margin="2,0"
                                    Height="{TemplateBinding ContentHeight}" Width="{TemplateBinding ContentWidth}" VerticalAlignment="Center" HorizontalAlignment="Center"/>

                            <!--Remove later.-->
                            <Viewbox Grid.Column="0" x:Name="ViewBoxInternal" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="2,0" Stretch="Uniform" StretchDirection="Both" 
                                     Width="{TemplateBinding ContentWidth}" Height="{TemplateBinding ContentHeight}" Effect="{x:Null}">
                                <ContentPresenter Content="{TemplateBinding Image}" Width="Auto" Height="Auto" Opacity="{DynamicResource Element.Opacity}"/>
                            </Viewbox>

                            <ContentPresenter Grid.Column="1" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                              Margin="5,0,0,0" VerticalAlignment="Center"/>

                            <!--<TextBlock Grid.Column="2" Margin="5,5,5,3" HorizontalAlignment="Left" VerticalAlignment="Center">
                                <Run Text="•" Foreground="{DynamicResource Element.Foreground.Medium}"/>
                                <Run Text="{TemplateBinding MainAuthor}" Foreground="{DynamicResource Element.Foreground.Medium}" FontWeight="Bold" ToolTip="Current translator"/>
                                <Run Text="-" Foreground="{DynamicResource Element.Foreground.Medium}"/>
                                <Run Text="{TemplateBinding Author}" Foreground="{DynamicResource Element.Foreground.Gray112}"/>
                            </TextBlock>-->
                            
                            <Label Grid.Column="2" Content="{TemplateBinding Author}" Foreground="{DynamicResource Element.Foreground.Gray112}" Margin="5,0,0,0" HorizontalAlignment="Left"/>
                            
                            <Viewbox Grid.Column="3" x:Name="SelectionMark" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="2,0" Stretch="UniformToFill" StretchDirection="Both" 
                                     MaxWidth="{TemplateBinding ContentWidth}" Effect="{x:Null}" Visibility="Collapsed">
                                <Path x:Name="optionMark" Data="F1 M 9.97498,.8 L 4.6983,9.09834  L 1,5.19331 L 1.27664,3.52165 L 4.255,6.08833 L 9.33331,1.288e-005 Z" Fill="{DynamicResource Element.Glyph}" 
                                      Margin="1" Stretch="None"/>
                            </Viewbox>
                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" TargetName="Bd" Value="{DynamicResource Item.MouseOver.Background}"/>
                            <Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource Item.MouseOver.Border}"/>
                        </MultiTrigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Selector.IsSelectionActive" Value="False"/>
                                <Condition Property="IsSelected" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" TargetName="Bd" Value="{DynamicResource Item.SelectedInactive.Background}"/>
                            <Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource Item.SelectedInactive.Border}"/>
                        </MultiTrigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Selector.IsSelectionActive" Value="True"/>
                                <Condition Property="IsSelected" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" TargetName="Bd" Value="{DynamicResource Item.SelectedActive.Background}"/>
                            <Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource Item.SelectedActive.Border}"/>
                        </MultiTrigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="ShowMarkOnSelection" Value="True"/>
                                <Condition Property="IsSelected" Value="True"/>
                            </MultiTrigger.Conditions>

                            <Setter TargetName="SelectionMark" Property="Visibility" Value="Visible"/>
                        </MultiTrigger>
                        
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Opacity" Value="0.7"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--FrameListViewItem Style-->
    <Style TargetType="{x:Type n:FrameListBoxItem}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Padding" Value="4,1"/>
        <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="FocusVisualStyle" Value="{DynamicResource Style.FocusVisual.NoMargin}"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:FrameListBoxItem}">
                    <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>

                            <Viewbox x:Name="ViewBoxInternal" VerticalAlignment="Center" HorizontalAlignment="Center" Stretch="Uniform" StretchDirection="Both"
                                     MaxWidth="{TemplateBinding MaxSize}" MaxHeight="{TemplateBinding MaxSize}" Effect="{x:Null}">
                                <Image Source="{TemplateBinding Image, Converter={StaticResource UriToBitmapConverter}, ConverterParameter=100}" Width="Auto" Height="Auto" Effect="{DynamicResource Shadow.Border.Large}"/>
                            </Viewbox>

                            <Grid Grid.Row="1">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                    <ColumnDefinition/>
                                </Grid.ColumnDefinitions>

                                <TextBlock x:Name="NumberLabel" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=FrameNumber, StringFormat={}{0}}" Foreground="{DynamicResource Element.Foreground.Gray112}" 
                                           HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0" Padding="0"/>

                                <TextBlock x:Name="DelayLabel" Grid.Column="1" Text="{TemplateBinding Delay, Converter={StaticResource IntToDelayStringConverter}}" Foreground="{DynamicResource Element.Foreground.Gray112}"
                                           HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0" Padding="0" FontSize="11" FontWeight="Normal" FontStyle="Italic"/>
                            </Grid>
                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" TargetName="Bd" Value="{DynamicResource Item.MouseOver.Background}"/>
                            <Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource Item.MouseOver.Border}"/>
                        </MultiTrigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Selector.IsSelectionActive" Value="False"/>
                                <Condition Property="IsSelected" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" TargetName="Bd" Value="{DynamicResource Item.SelectedInactive.Background}"/>
                            <Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource Item.SelectedInactive.Border}"/>
                        </MultiTrigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Selector.IsSelectionActive" Value="True"/>
                                <Condition Property="IsSelected" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" TargetName="Bd" Value="{DynamicResource Item.SelectedActive.Background}"/>
                            <Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource Item.SelectedActive.Border}"/>
                        </MultiTrigger>

                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Opacity" Value="0.7"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <!--NotificationBox Style-->
    <Style TargetType="{x:Type n:NotificationBox}">
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Margin" Value="2"/>
        <Setter Property="Background" Value="{DynamicResource Panel.Background}"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:NotificationBox}">
                    <Border BorderBrush="{DynamicResource Element.Border}" BorderThickness="{TemplateBinding BorderThickness}" Margin="{TemplateBinding Margin}" 
                            Background="{TemplateBinding Background}" Effect="{DynamicResource Shadow.Border.Dark}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>

                            <ScrollViewer Grid.Row="0" x:Name="MainScrollViewer" Focusable="False" Padding="{TemplateBinding Padding}" VerticalScrollBarVisibility="Auto">
                                <ItemsPresenter/>
                            </ScrollViewer>

                            <TextBlock Grid.Row="0" x:Name="EllipsesTextBlock" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="40" Height="46" Margin="0,-30,0,0" Text="..." 
                                       Foreground="{DynamicResource Element.Foreground.Gray112}" Visibility="Collapsed"/>

                            <Grid Grid.Row="1" x:Name="ControlGrid" Background="{DynamicResource Panel.Background.Level2}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                    <ColumnDefinition/>
                                </Grid.ColumnDefinitions>

                                <TextBlock Grid.Column="0" x:Name="NotificationTextBlock" Margin="5" HorizontalAlignment="Center" FontSize="14" TextWrapping="Wrap">
                                    <Hyperlink x:Name="NotificationHyperlink">
                                        <Run Text="{DynamicResource S.Notifications.Dismiss}"/>
                                    </Hyperlink>
                                </TextBlock>

                                <TextBlock Grid.Column="1" x:Name="EncodingTextBlock" Margin="5" HorizontalAlignment="Center" FontSize="14" TextWrapping="Wrap">
                                    <Hyperlink x:Name="EncodingHyperlink">
                                        <Run Text="{DynamicResource S.Encoder.Dismiss}"/>
                                    </Hyperlink>
                                </TextBlock>
                            </Grid>
                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="HasAnyNotification" Value="False"/>
                                <Condition Property="HasAnyEncoding" Value="False"/>
                            </MultiTrigger.Conditions>

                            <Setter TargetName="EllipsesTextBlock" Property="Visibility" Value="Visible"/>
                        </MultiTrigger>
                        
                        <Trigger Property="OnlyDisplayList" Value="True">
                            <Setter TargetName="ControlGrid" Property="Visibility" Value="Collapsed"/>
                        </Trigger>

                        <Trigger Property="HasAnyNotification" Value="False">
                            <Setter TargetName="NotificationTextBlock" Property="IsEnabled" Value="False"/>
                        </Trigger>

                        <Trigger Property="HasAnyEncoding" Value="False">
                            <Setter TargetName="EncodingTextBlock" Property="IsEnabled" Value="False"/>
                        </Trigger>

                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="IsHitTestVisible" Value="False"/>
                            <Setter Property="Opacity" Value="0.8"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <!--ExtendedProgressBar Style-->
    <Style TargetType="{x:Type n:ExtendedProgressBar}">
        <Setter Property="Foreground" Value="{DynamicResource Brush.ProgressBar.Primary}"/>
        <Setter Property="Background" Value="{DynamicResource Element.Background.Back}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource Element.Border}"/>
        <Setter Property="BorderThickness" Value="1"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:ExtendedProgressBar}">
                    <Grid x:Name="TemplateRoot">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Determinate"/>
                                <VisualState x:Name="Indeterminate">
                                    <Storyboard RepeatBehavior="Forever">
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="Animation">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0.25"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0.25"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:2" Value="0.25"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)" Storyboard.TargetName="Animation">
                                            <EasingPointKeyFrame KeyTime="0" Value="-0.5,0.5"/>
                                            <EasingPointKeyFrame KeyTime="0:0:1" Value="0.5,0.5"/>
                                            <EasingPointKeyFrame KeyTime="0:0:2" Value="1.5,0.5"/>
                                        </PointAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"/>
                        <Rectangle x:Name="PART_Track"/>

                        <Grid x:Name="PART_Indicator" ClipToBounds="True" HorizontalAlignment="Left">
                            <Rectangle x:Name="Indicator" Fill="{TemplateBinding Foreground}"/>
                            <Rectangle x:Name="Animation" Fill="{TemplateBinding Foreground}" RenderTransformOrigin="0.5,0.5" Visibility="Collapsed">
                                <Rectangle.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform/>
                                        <SkewTransform/>
                                        <RotateTransform/>
                                        <TranslateTransform/>
                                    </TransformGroup>
                                </Rectangle.RenderTransform>
                            </Rectangle>
                        </Grid>

                        <Border x:Name="PercentageBorder" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="Collapsed" Background="{DynamicResource Brush.ProgressBar.Detail}" CornerRadius="5">
                            <TextBlock x:Name="PercentageTextBlock" Foreground="{DynamicResource Element.Foreground}" Margin="3,0" Padding="0" VerticalAlignment="Center">
                                <TextBlock.Text>
                                    <MultiBinding Converter="{StaticResource ScaleConverter}" StringFormat="{}{0:P2}">
                                        <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Value"/>
                                        <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Maximum"/>
                                    </MultiBinding>
                                </TextBlock.Text>
                            </TextBlock>
                        </Border>
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="Orientation" Value="Vertical">
                            <Setter Property="LayoutTransform" TargetName="TemplateRoot">
                                <Setter.Value>
                                    <RotateTransform Angle="-90"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>

                        <Trigger Property="ShowPercentage" Value="True">
                            <Setter TargetName="PercentageBorder" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        
                        <Trigger Property="IsIndeterminate" Value="True">
                            <Setter Property="Visibility" TargetName="Indicator" Value="Collapsed"/>
                            <Setter Property="Visibility" TargetName="Animation" Value="Visible"/>
                            <Setter TargetName="PercentageBorder" Property="Visibility" Value="Collapsed"/>
                        </Trigger>

                        <Trigger Property="State" Value="Info">
                            <Setter Property="Foreground" Value="{DynamicResource Brush.ProgressBar.Info}"/>
                        </Trigger>
                        
                        <Trigger Property="State" Value="Warning">
                            <Setter Property="Foreground" Value="{DynamicResource Brush.ProgressBar.Warning}"/>
                        </Trigger>

                        <Trigger Property="State" Value="Danger">
                            <Setter Property="Foreground" Value="{DynamicResource Brush.ProgressBar.Danger}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    

    <!--SelectControl Style-->
    <Style TargetType="{x:Type n:SelectControlOld}">
        <Setter Property="Background" Value="#30000000"/>
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="BorderBrush" Value="White"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:SelectControlOld}">
                    <Canvas x:Name="MainCanvas" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
                        <Canvas.Resources>
                            <Storyboard x:Key="StrokeDashStoryboard" x:Name="StrokeDashStoryboard">
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MainPath" Storyboard.TargetProperty="(Shape.StrokeDashOffset)" RepeatBehavior="Forever">
                                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                                    <SplineDoubleKeyFrame KeyTime="00:00:00.6000000" Value="10"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </Canvas.Resources>

                        <Canvas.Triggers>
                            <EventTrigger RoutedEvent="n:SelectControlOld.Loaded">
                                <BeginStoryboard Storyboard="{StaticResource StrokeDashStoryboard}"/>
                            </EventTrigger>
                            <EventTrigger RoutedEvent="n:SelectControlOld.SelectionAccepted">
                                <StopStoryboard BeginStoryboardName="StrokeDashStoryboard"/>
                            </EventTrigger>
                            <EventTrigger RoutedEvent="n:SelectControlOld.SelectionCanceled">
                                <StopStoryboard BeginStoryboardName="StrokeDashStoryboard"/>
                            </EventTrigger>
                        </Canvas.Triggers>

                        <Path x:Name="MainPath" Grid.ZIndex="0" StrokeDashArray="5" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}" 
                              Fill="{TemplateBinding Background}" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
                            <Path.Data>
                                <CombinedGeometry GeometryCombineMode="Exclude">
                                    <CombinedGeometry.Geometry1>
                                        <RectangleGeometry x:Name="ExternalRect">
                                            <RectangleGeometry.Rect>
                                                <MultiBinding Converter="{StaticResource IntToRect}">
                                                    <Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="ActualWidth" Mode="OneWay" UpdateSourceTrigger="PropertyChanged"/>
                                                    <Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="ActualHeight" Mode="OneWay" UpdateSourceTrigger="PropertyChanged"/>
                                                </MultiBinding>
                                            </RectangleGeometry.Rect>
                                        </RectangleGeometry>
                                    </CombinedGeometry.Geometry1>
                                    <CombinedGeometry.Geometry2>
                                        <RectangleGeometry x:Name="InternalRect">
                                            <RectangleGeometry.Rect>
                                                <MultiBinding Converter="{StaticResource IntToRect}">
                                                    <Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Selected.Width" Mode="OneWay" UpdateSourceTrigger="PropertyChanged"/>
                                                    <Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Selected.Height" Mode="OneWay" UpdateSourceTrigger="PropertyChanged"/>
                                                    <Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Selected.X" Mode="OneWay" UpdateSourceTrigger="PropertyChanged"/>
                                                    <Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Selected.Y" Mode="OneWay" UpdateSourceTrigger="PropertyChanged"/>
                                                </MultiBinding>
                                            </RectangleGeometry.Rect>
                                        </RectangleGeometry>
                                    </CombinedGeometry.Geometry2>
                                </CombinedGeometry>
                            </Path.Data>
                        </Path>

                        <Rectangle x:Name="SelectRectangle" Fill="#20FFFFFF" Grid.ZIndex="1"
                                   Canvas.Left="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Left}" Canvas.Top="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Top}"
                                   Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Width}" Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Height}"/>

                        <n:ExtendedUniformGrid x:Name="StatusControlGrid" Columns="3" Cursor="Arrow" Visibility="Hidden" Grid.ZIndex="9" Background="{DynamicResource Element.Background}">
                            <n:ExtendedButton x:Name="AcceptButton" Text="{DynamicResource S.Recorder.Accept}" ContentWidth="24" ContentHeight="24" Style="{DynamicResource Style.Button.Horizontal.White}" 
                                              Icon="{DynamicResource Vector.Ok}" ToolTip="Enter" ToolTipService.Placement="Bottom" Height="30" Padding="4"/>

                            <n:ExtendedButton x:Name="RetryButton" Text="{DynamicResource S.Recorder.Retry}" ContentWidth="24" ContentHeight="24" Style="{DynamicResource Style.Button.Horizontal.White}" 
                                              Icon="{DynamicResource Vector.Synchronize}" ToolTip="{DynamicResource S.Recorder.Retry.Shortcut}" ToolTipService.Placement="Bottom" Height="30" Padding="4"/>

                            <n:ExtendedButton x:Name="CancelButton" Text="{DynamicResource S.Cancel}" ContentWidth="24" ContentHeight="24" Style="{DynamicResource Style.Button.Horizontal.White}" 
                                              Icon="{DynamicResource Vector.Cancel}" ToolTip="Esc" ToolTipService.Placement="Bottom" Height="30" Padding="4"/>
                        </n:ExtendedUniformGrid>

                        <TextBlock x:Name="SizeTextBlock" Grid.ZIndex="1" FontSize="18" Foreground="White" Background="#60000000" Padding="2,0"
                                   VerticalAlignment="Center" HorizontalAlignment="Center" IsHitTestVisible="False" Visibility="Hidden">
                            <TextBlock.Text>
                                <MultiBinding StringFormat="{}{0} × {1}">
                                    <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="NonExpandedSelection.Width" UpdateSourceTrigger="PropertyChanged"/>
                                    <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="NonExpandedSelection.Height" UpdateSourceTrigger="PropertyChanged"/>
                                </MultiBinding>
                            </TextBlock.Text>
                        </TextBlock>

                        <Thumb Grid.ZIndex="2" x:Name="TopLeftThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeNWSE" Visibility="Collapsed"/>
                        <Thumb Grid.ZIndex="2" x:Name="TopRightThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeNESW" Visibility="Collapsed"/>
                        <Thumb Grid.ZIndex="2" x:Name="BottomLeftThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeNESW" Visibility="Collapsed"/>
                        <Thumb Grid.ZIndex="2" x:Name="BottomRightThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeNWSE" Visibility="Collapsed"/>

                        <Thumb Grid.ZIndex="2" x:Name="TopThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeNS" Visibility="Collapsed"/>
                        <Thumb Grid.ZIndex="2" x:Name="BottomThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeNS" Visibility="Collapsed"/>
                        <Thumb Grid.ZIndex="2" x:Name="LeftThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeWE" Visibility="Collapsed"/>
                        <Thumb Grid.ZIndex="2" x:Name="RightThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeWE" Visibility="Collapsed"/>

                        <Grid x:Name="ZoomGrid" Height="140" Width="120" Background="#60000000" Visibility="Hidden" Grid.ZIndex="8">
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition Height="2"/>
                                <RowDefinition/>
                                <RowDefinition Height="20"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition Width="2"/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>

                            <Image Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" Grid.ColumnSpan="3" x:Name="CroppedImage" Stretch="UniformToFill" 
                                   RenderOptions.BitmapScalingMode="NearestNeighbor" RenderOptions.EdgeMode="Unspecified" UseLayoutRounding="True"/>

                            <Rectangle Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Height="2" Stroke="#6020FF00" StrokeThickness="2"/>
                            <Rectangle Grid.Row="1" Grid.Column="2" Height="2" Stroke="#6020FF00" StrokeThickness="2"/>
                            <Rectangle Grid.Row="0" Grid.Column="1" Width="2" Stroke="#6020FF00" StrokeThickness="2"/>
                            <Rectangle Grid.Row="2" Grid.Column="1" Width="2" Stroke="#6020FF00" StrokeThickness="2"/>

                            <TextBlock Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3" x:Name="ZoomTextBlock" Foreground="AliceBlue" Text="X: 1 Y: 2" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                        </Grid>

                        <!--<Grid x:Name="RectGrid" Height="Auto" Width="Auto" Background="#60000000" Grid.ZIndex="9" Visibility="Hidden">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>

                            <Grid Grid.Row="0" x:Name="MoveSizeWidgetGrid">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="20"/>
                                </Grid.ColumnDefinitions>

                                <TextBlock Grid.Column="0" Padding="3,2" Text="Selection"/>
                                <n:ExtendedButton Grid.Column="1" x:Name="CloseSizeWidgetButton" Icon="{DynamicResource Vector.Cancel}" Style="{DynamicResource Style.Button.NoText.White}" Padding="2"/>
                            </Grid>

                            <Grid Grid.Row="1" Background="#20000000">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>

                                <TextBlock Grid.Row="0" Grid.Column="0" Padding="3,2" Text="Left:" VerticalAlignment="Center"/>
                                <n:IntegerBox Grid.Row="0" Grid.Column="1" Margin="2,1" MinWidth="60" HorizontalAlignment="Stretch" UpdateOnInput="False"
                                              Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Left}"/>

                                <TextBlock Grid.Row="1" Grid.Column="0" Padding="3,2" Text="Top:" VerticalAlignment="Center"/>
                                <n:IntegerBox Grid.Row="1" Grid.Column="1" Margin="2,1" MinWidth="60" HorizontalAlignment="Stretch" UpdateOnInput="False"
                                              Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Top}"/>

                                <TextBlock Grid.Row="2" Grid.Column="0" Padding="3,2" Text="Width:" VerticalAlignment="Center"/>
                                <n:IntegerBox Grid.Row="2" Grid.Column="1" Margin="2,1" MinWidth="60" HorizontalAlignment="Stretch" UpdateOnInput="False"
                                              Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Width, Mode=TwoWay}"/>

                                <TextBlock Grid.Row="3" Grid.Column="0" Padding="3,2" Text="Height:" VerticalAlignment="Center"/>
                                <n:IntegerBox Grid.Row="3" Grid.Column="1" Margin="2,1" MinWidth="60" HorizontalAlignment="Stretch" UpdateOnInput="False"
                                              Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Height, Mode=TwoWay}"/>
                            </Grid>
                        </Grid>-->
                    </Canvas>

                    <ControlTemplate.Triggers>
                        <Trigger Property="FinishedSelection" Value="True">
                            <Setter TargetName="TopLeftThumb" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="TopRightThumb" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="BottomLeftThumb" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="BottomRightThumb" Property="Visibility" Value="Visible"/>

                            <Setter TargetName="TopThumb" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="BottomThumb" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="LeftThumb" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="RightThumb" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="Mode" Value="Region">
                            <Setter TargetName="MainCanvas" Property="Cursor" Value="Cross"/>
                            <Setter TargetName="SelectRectangle" Property="Cursor" Value="SizeAll"/>
                        </Trigger>
                        <Trigger Property="Mode" Value="Window">
                            <Setter TargetName="SelectRectangle" Property="Cursor" Value="Hand"/>
                        </Trigger>
                        <Trigger Property="Mode" Value="Fullscreen">
                            <Setter TargetName="SelectRectangle" Property="Cursor" Value="Hand"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type n:SelectControl}">
        <Setter Property="Background" Value="#30000000"/>
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="BorderBrush" Value="White"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:SelectControl}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="StrokeDashStoryboard" x:Name="StrokeDashStoryboard">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MainPath" Storyboard.TargetProperty="(Shape.StrokeDashOffset)" RepeatBehavior="Forever">
                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                                <SplineDoubleKeyFrame KeyTime="00:00:00.6" Value="10"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    
                    <Canvas x:Name="MainCanvas" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
                        <Path x:Name="MainPath" Grid.ZIndex="0" StrokeDashArray="5" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}" 
                              Fill="{TemplateBinding Background}" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
                            <Path.Data>
                                <CombinedGeometry GeometryCombineMode="Exclude">
                                    <CombinedGeometry.Geometry1>
                                        <RectangleGeometry x:Name="ExternalRect">
                                            <RectangleGeometry.Rect>
                                                <MultiBinding Converter="{StaticResource IntToRect}" FallbackValue="0,0,0,0">
                                                    <Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="ActualWidth" Mode="OneWay" UpdateSourceTrigger="PropertyChanged"/>
                                                    <Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="ActualHeight" Mode="OneWay" UpdateSourceTrigger="PropertyChanged"/>
                                                </MultiBinding>
                                            </RectangleGeometry.Rect>
                                        </RectangleGeometry>
                                    </CombinedGeometry.Geometry1>
                                    <CombinedGeometry.Geometry2>
                                        <RectangleGeometry x:Name="InternalRect">
                                            <RectangleGeometry.Rect>
                                                <MultiBinding Converter="{StaticResource IntToRect}" FallbackValue="0,0,0,0">
                                                    <Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Selected.Width" Mode="OneWay" UpdateSourceTrigger="PropertyChanged" FallbackValue="0"/>
                                                    <Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Selected.Height" Mode="OneWay" UpdateSourceTrigger="PropertyChanged" FallbackValue="0"/>
                                                    <Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Selected.X" Mode="OneWay" UpdateSourceTrigger="PropertyChanged" FallbackValue="0"/>
                                                    <Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Selected.Y" Mode="OneWay" UpdateSourceTrigger="PropertyChanged" FallbackValue="0"/>
                                                </MultiBinding>
                                            </RectangleGeometry.Rect>
                                        </RectangleGeometry>
                                    </CombinedGeometry.Geometry2>
                                </CombinedGeometry>
                            </Path.Data>
                        </Path>

                        <Rectangle x:Name="SelectRectangle" Fill="#20FFFFFF" Grid.ZIndex="1"
                                   Canvas.Left="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Left, FallbackValue=0}" 
                                   Canvas.Top="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Top, FallbackValue=0}"
                                   Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Width, FallbackValue=0}" 
                                   Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Height, FallbackValue=0}"/>

                        <n:ExtendedUniformGrid x:Name="StatusControlGrid" Columns="3" Cursor="Arrow" Visibility="Hidden" Grid.ZIndex="9" Background="{DynamicResource Element.Background}">
                            <n:ExtendedButton x:Name="AcceptButton" Text="{DynamicResource S.Recorder.Accept}" ContentWidth="22" ContentHeight="22" Style="{DynamicResource Style.Button.Horizontal.White}" 
                                              Icon="{DynamicResource Vector.Ok}" ToolTip="Enter" ToolTipService.Placement="Bottom" Height="30" Padding="4"/>

                            <n:ExtendedButton x:Name="RetryButton" Text="{DynamicResource S.Recorder.Retry}" ContentWidth="22" ContentHeight="22" Style="{DynamicResource Style.Button.Horizontal.White}" 
                                              Icon="{DynamicResource Vector.Synchronize}" ToolTip="Right-Click" ToolTipService.Placement="Bottom" Height="30" Padding="4"/>

                            <n:ExtendedButton x:Name="CancelButton" Text="{DynamicResource S.Cancel}" ContentWidth="22" ContentHeight="22" Style="{DynamicResource Style.Button.Horizontal.White}" 
                                              Icon="{DynamicResource Vector.Cancel}" ToolTip="Esc" ToolTipService.Placement="Bottom" Height="30" Padding="4"/>
                        </n:ExtendedUniformGrid>

                        <Grid x:Name="SizeGrid" Grid.ZIndex="1" Background="#75000000" Visibility="Hidden">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>

                            <TextBlock Grid.Row="0" x:Name="SizeTextBlock" Padding="2,0"
                                   VerticalAlignment="Center" HorizontalAlignment="Center" IsHitTestVisible="False">
                                <Run FontSize="18" Foreground="White">
                                    <Run.Text>
                                        <MultiBinding StringFormat="{}{0} × {1}">
                                            <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="NonExpandedSelection.Width" UpdateSourceTrigger="PropertyChanged"/>
                                            <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="NonExpandedSelection.Height" UpdateSourceTrigger="PropertyChanged"/>
                                        </MultiBinding>
                                    </Run.Text>
                                </Run>
                                
                                <Run x:Name="ScaleRun" FontSize="16" Foreground="Cyan" 
                                     Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Scale, UpdateSourceTrigger=PropertyChanged, StringFormat={} ×{0:0.00}}"/>
                            </TextBlock>

                            <TextBlock Grid.Row="1" x:Name="NativeSizeTextBlock" Padding="2,0"
                                   VerticalAlignment="Center" HorizontalAlignment="Center" IsHitTestVisible="False">
                                <Run FontSize="18" Foreground="White">
                                    <Run.Text>
                                    <MultiBinding StringFormat="{}{0} × {1}">
                                        <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="NonExpandedNativeSelection.Width" UpdateSourceTrigger="PropertyChanged"/>
                                        <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="NonExpandedNativeSelection.Height" UpdateSourceTrigger="PropertyChanged"/>
                                    </MultiBinding>
                                    </Run.Text>
                                </Run>
                                
                                <Run FontSize="16" Foreground="Aqua" Text=" ×1.00"/>
                            </TextBlock>
                        </Grid>

                        <Thumb Grid.ZIndex="2" x:Name="TopLeftThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeNWSE" Visibility="Collapsed"/>
                        <Thumb Grid.ZIndex="2" x:Name="TopRightThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeNESW" Visibility="Collapsed"/>
                        <Thumb Grid.ZIndex="2" x:Name="BottomLeftThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeNESW" Visibility="Collapsed"/>
                        <Thumb Grid.ZIndex="2" x:Name="BottomRightThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeNWSE" Visibility="Collapsed"/>

                        <Thumb Grid.ZIndex="2" x:Name="TopThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeNS" Visibility="Collapsed"/>
                        <Thumb Grid.ZIndex="2" x:Name="BottomThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeNS" Visibility="Collapsed"/>
                        <Thumb Grid.ZIndex="2" x:Name="LeftThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeWE" Visibility="Collapsed"/>
                        <Thumb Grid.ZIndex="2" x:Name="RightThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeWE" Visibility="Collapsed"/>

                        <Grid x:Name="ZoomGrid" Height="140" Width="120" Background="#60000000" Visibility="Hidden" Grid.ZIndex="8">
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition Height="2"/>
                                <RowDefinition/>
                                <RowDefinition Height="20"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition Width="2"/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>

                            <Image Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" Grid.ColumnSpan="3" x:Name="CroppedImage" Stretch="UniformToFill" 
                                   RenderOptions.BitmapScalingMode="NearestNeighbor" RenderOptions.EdgeMode="Unspecified" UseLayoutRounding="True"/>

                            <Rectangle Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Height="2" Stroke="#6020FF00" StrokeThickness="2"/>
                            <Rectangle Grid.Row="1" Grid.Column="2" Height="2" Stroke="#6020FF00" StrokeThickness="2"/>
                            <Rectangle Grid.Row="0" Grid.Column="1" Width="2" Stroke="#6020FF00" StrokeThickness="2"/>
                            <Rectangle Grid.Row="2" Grid.Column="1" Width="2" Stroke="#6020FF00" StrokeThickness="2"/>

                            <TextBlock Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3" x:Name="ZoomTextBlock" Foreground="AliceBlue" Text="X: 1 Y: 2" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                        </Grid>

                        <!--<Grid x:Name="RectGrid" Height="Auto" Width="Auto" Background="#60000000" Grid.ZIndex="9" Visibility="Hidden">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>

                            <Grid Grid.Row="0" x:Name="MoveSizeWidgetGrid">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="20"/>
                                </Grid.ColumnDefinitions>

                                <TextBlock Grid.Column="0" Padding="3,2" Text="Selection"/>
                                <n:ExtendedButton Grid.Column="1" x:Name="CloseSizeWidgetButton" Icon="{DynamicResource Vector.Cancel}" Style="{DynamicResource Style.Button.NoText.White}" Padding="2"/>
                            </Grid>

                            <Grid Grid.Row="1" Background="#20000000">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>

                                <TextBlock Grid.Row="0" Grid.Column="0" Padding="3,2" Text="Left:" VerticalAlignment="Center"/>
                                <n:IntegerBox Grid.Row="0" Grid.Column="1" Margin="2,1" MinWidth="60" HorizontalAlignment="Stretch" UpdateOnInput="False"
                                              Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Left}"/>

                                <TextBlock Grid.Row="1" Grid.Column="0" Padding="3,2" Text="Top:" VerticalAlignment="Center"/>
                                <n:IntegerBox Grid.Row="1" Grid.Column="1" Margin="2,1" MinWidth="60" HorizontalAlignment="Stretch" UpdateOnInput="False"
                                              Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Top}"/>

                                <TextBlock Grid.Row="2" Grid.Column="0" Padding="3,2" Text="Width:" VerticalAlignment="Center"/>
                                <n:IntegerBox Grid.Row="2" Grid.Column="1" Margin="2,1" MinWidth="60" HorizontalAlignment="Stretch" UpdateOnInput="False"
                                              Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Width, Mode=TwoWay}"/>

                                <TextBlock Grid.Row="3" Grid.Column="0" Padding="3,2" Text="Height:" VerticalAlignment="Center"/>
                                <n:IntegerBox Grid.Row="3" Grid.Column="1" Margin="2,1" MinWidth="60" HorizontalAlignment="Stretch" UpdateOnInput="False"
                                              Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Height, Mode=TwoWay}"/>
                            </Grid>
                        </Grid>-->
                    </Canvas>

                    <ControlTemplate.Triggers>
                        <Trigger Property="FinishedSelection" Value="True">
                            <Setter TargetName="TopLeftThumb" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="TopRightThumb" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="BottomLeftThumb" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="BottomRightThumb" Property="Visibility" Value="Visible"/>

                            <Setter TargetName="TopThumb" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="BottomThumb" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="LeftThumb" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="RightThumb" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        
                        <Trigger Property="Mode" Value="Region">
                            <Setter TargetName="MainCanvas" Property="Cursor" Value="Cross"/>
                            <Setter TargetName="SelectRectangle" Property="Cursor" Value="SizeAll"/>
                        </Trigger>
                        <Trigger Property="Mode" Value="Window">
                            <Setter TargetName="SelectRectangle" Property="Cursor" Value="Hand"/>
                        </Trigger>
                        <Trigger Property="Mode" Value="Fullscreen">
                            <Setter TargetName="SelectRectangle" Property="Cursor" Value="Hand"/>
                        </Trigger>
                        <Trigger Property="Scale" Value="1">
                            <Setter TargetName="NativeSizeTextBlock" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="ScaleRun" Property="Text" Value=""/>
                        </Trigger>
                        <Trigger Property="Selected" Value="{x:Static Rect.Empty}">
                            <Setter TargetName="SelectRectangle" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        
                        <Trigger Property="AnimateBorder" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MainPath" Storyboard.TargetProperty="(Shape.StrokeDashOffset)" RepeatBehavior="Forever">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.6" Value="10"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    
    <!--MoveResizeControl Style-->
    <Style TargetType="{x:Type n:MoveResizeControl}">
        <Setter Property="BorderBrush" Value="White"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:MoveResizeControl}">
                    <Canvas Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" ClipToBounds="True">
                        <Border x:Name="SelectBorder" Cursor="SizeAll"
                                Canvas.Left="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Left}" Canvas.Top="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Top}"
                                Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Width}" Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Height}">
                            <ContentPresenter/>
                        </Border>

                        <Rectangle x:Name="DashedRectangle" StrokeDashArray="5" Stroke="#FFABABAB" 
                                   Canvas.Left="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Left}" Canvas.Top="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Top}"
                                   Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Width}" Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selected.Height}"/>

                        <Thumb x:Name="TopLeftThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeNWSE" Visibility="Collapsed"/>
                        <Thumb x:Name="TopRightThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeNESW" Visibility="Collapsed"/>
                        <Thumb x:Name="BottomLeftThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeNESW" Visibility="Collapsed"/>
                        <Thumb x:Name="BottomRightThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeNWSE" Visibility="Collapsed"/>

                        <Thumb x:Name="TopThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeNS" Visibility="Collapsed"/>
                        <Thumb x:Name="BottomThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeNS" Visibility="Collapsed"/>
                        <Thumb x:Name="LeftThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeWE" Visibility="Collapsed"/>
                        <Thumb x:Name="RightThumb" Style="{DynamicResource ScrollBar.Thumb}" Height="10" Width="10" Cursor="SizeWE" Visibility="Collapsed"/>
                    </Canvas>

                    <ControlTemplate.Triggers>
                        <Trigger Property="CanResize" Value="True">
                            <Setter TargetName="TopLeftThumb" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="TopRightThumb" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="BottomLeftThumb" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="BottomRightThumb" Property="Visibility" Value="Visible"/>

                            <Setter TargetName="TopThumb" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="BottomThumb" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="LeftThumb" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="RightThumb" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="CanMove" Value="False">
                            <Setter TargetName="SelectBorder" Property="Cursor" Value="Arrow"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="CanResize" Value="False"/>
                                <Condition Property="CanMove" Value="False"/>
                            </MultiTrigger.Conditions>

                            <Setter TargetName="DashedRectangle" Property="Visibility" Value="Hidden"/>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--DrawingCanvas Style-->
    <Style TargetType="{x:Type n:DrawingCanvas}">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Focusable" Value="True"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:DrawingCanvas}">
                    <Grid>
                        <Canvas x:Name="MainCanvas" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Background="{TemplateBinding Background}">
                            <Rectangle x:Name="SelectionRectangle" Fill="#80737373" Panel.ZIndex="{Binding RelativeSource={RelativeSource TemplatedParent}, Path= ControlsZIndex}" Stroke="#FF737373" StrokeThickness="1" Tag="0"
                                       Canvas.Left="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selection.Left}" Canvas.Top="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selection.Top}"
                                       Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selection.Width}" Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Selection.Height}"/>
                        </Canvas>

                        <InkCanvas x:Name="MainInkCanvas" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Background="Transparent" Visibility="Collapsed"/>
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="DrawingMode" Value="Shape">
                            <Setter Property="Cursor" Value="Cross"/>
                            <Setter TargetName="SelectionRectangle" Property="Cursor" Value="SizeAll"/>
                        </Trigger>
                        <Trigger Property="DrawingMode" Value="Select">
                            <Setter TargetName="SelectionRectangle" Property="Cursor" Value="Hand"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--DisplayTimer Style-->
    <Style TargetType="{x:Type n:DisplayTimer}">
        <Setter Property="Background" Value="DarkRed"/>
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Focusable" Value="False"/>
        
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:DisplayTimer}">
                    <Border x:Name="MainBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderBrush}" Padding="{TemplateBinding Padding}"
                            CornerRadius="{TemplateBinding CornerRadius}" VerticalAlignment="{TemplateBinding VerticalAlignment}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}">
                        <Border.ToolTip>
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>

                                <TextBlock Grid.Row="0" x:Name="ElapsedTooltipTextBlock" Text="{DynamicResource S.Recorder.Timer.Elapsed}"/>

                                <TextBlock Grid.Row="1" x:Name="AutomaticTooltipTextBlock">
                                    <Run Text="{DynamicResource S.Recorder.Timer.Total}"/>
                                    <Run Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CapturedCount, StringFormat={}{0:N0}}"/>
                                </TextBlock>

                                <TextBlock Grid.Row="2" x:Name="ManualTooltipTextBlock">
                                    <Run Text="{DynamicResource S.Recorder.Timer.Manual}"/>
                                    <Run Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ManuallyCapturedCount, StringFormat={}{0:N0}}"/>
                                </TextBlock>

                                <TextBlock Grid.Row="3" x:Name="PausedTooltipTextBlock" Text="{DynamicResource S.Recorder.Timer.Paused}" Margin="0,3,0,0" Visibility="Collapsed"/>
                                <TextBlock Grid.Row="3" x:Name="ImpreciseTooltipTextBlock" Text="{DynamicResource S.Recorder.Timer.Imprecise}" Margin="0,3,0,0" FontWeight="SemiBold" Visibility="Collapsed"/>
                            </Grid>
                        </Border.ToolTip>
                        
                        <Grid VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            
                            <Border Grid.Column="0" x:Name="ImpreciseBorder" Background="{DynamicResource Vector.Warning}" Height="12" Width="0" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                            <Border Grid.Column="1" x:Name="PauseBorder" Background="{DynamicResource Vector.Pause.Color}" Height="12" Width="0" VerticalAlignment="Center" HorizontalAlignment="Center"/>

                            <TextBlock Grid.Column="2" x:Name="NegativeTextBlock" FontSize="14" Padding="0" Margin="0" Text="-" Visibility="Collapsed"/>
                            <TextBlock Grid.Column="3" x:Name="ElapsedTextBlock" FontSize="14" Padding="0" Margin="0" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Elapsed, StringFormat={}{0:mm\\:ss}}"/>

                            <TextBlock Grid.Column="4" x:Name="ManualTextBlock" FontSize="14" Padding="0" Margin="2,0,0,0" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ManuallyCapturedCount, StringFormat={}+{0:0}}"/>
                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsRunning" Value="False">
                            <Setter TargetName="MainBorder" Property="Opacity" Value="0.7"/>
                        </Trigger>
                        
                        <Trigger Property="IsPaused" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard TargetName="PauseBorder">
                                        <DoubleAnimation Storyboard.TargetProperty="Width" Duration="0:0:0.1" From="0" To="12"/>
                                        <ThicknessAnimation Storyboard.TargetProperty="Margin" Duration="0:0:0.1" From="0" To="0,0,3,0"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>

                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard TargetName="PauseBorder">
                                        <DoubleAnimation Storyboard.TargetProperty="Width" Duration="0:0:0.1" From="12"/>
                                        <ThicknessAnimation Storyboard.TargetProperty="Margin" Duration="0:0:0.1" From="0,0,3,0"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>
                            
                            <Setter TargetName="PausedTooltipTextBlock" Property="Visibility" Value="Visible"/>
                        </Trigger>

                        <Trigger Property="IsImpreciseCapture" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard TargetName="ImpreciseBorder">
                                        <DoubleAnimation Storyboard.TargetProperty="Width" Duration="0:0:0.1" From="0" To="12"/>
                                        <ThicknessAnimation Storyboard.TargetProperty="Margin" Duration="0:0:0.1" From="0" To="0,0,3,0"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>

                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard TargetName="ImpreciseBorder">
                                        <DoubleAnimation Storyboard.TargetProperty="Width" Duration="0:0:0.1" From="12"/>
                                        <ThicknessAnimation Storyboard.TargetProperty="Margin" Duration="0:0:0.1" From="0,0,3,0"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>

                            <Setter TargetName="ImpreciseTooltipTextBlock" Property="Visibility" Value="Visible"/>
                        </Trigger>

                        <Trigger Property="IsNegative" Value="True">
                            <Setter TargetName="NegativeTextBlock" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        
                        <Trigger Property="Elapsed" Value="{x:Static s:TimeSpan.Zero}">
                            <Setter TargetName="ElapsedTextBlock" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="ElapsedTooltipTextBlock" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        
                        <Trigger Property="ManuallyCapturedCount" Value="0">
                            <Setter TargetName="ManualTextBlock" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="ManualTooltipTextBlock" Property="Visibility" Value="Collapsed"/>
                        </Trigger>

                        <Trigger Property="CapturedCount" Value="0">
                            <Setter TargetName="AutomaticTooltipTextBlock" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Elapsed" Value="{x:Static s:TimeSpan.Zero}"/>
                                <Condition Property="ManuallyCapturedCount" Value="0"/>
                            </MultiTrigger.Conditions>
                            
                            <Setter Property="Visibility" Value="Collapsed"/>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--TimeBox Style-->
    <Style TargetType="{x:Type n:TimeBox}">
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>
        <Setter Property="Background" Value="{DynamicResource Element.Background}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource Element.Border}"/>
        <Setter Property="Padding" Value="2"/>
        <Setter Property="MinHeight" Value="23"/>
        <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="AllowDrop" Value="True"/>
        <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type n:TimeBox}">
                    <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" 
                            VerticalAlignment="{TemplateBinding VerticalAlignment}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" SnapsToDevicePixels="True"
                            Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" MinWidth="{TemplateBinding MinWidth}" MinHeight="{TemplateBinding MinHeight}">
                        <Grid x:Name="InnerGrid">
                            <ScrollViewer x:Name="PART_ContentHost" Focusable="False" HorizontalScrollBarVisibility="Hidden" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalScrollBarVisibility="Hidden" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>

                            <Path x:Name="InnerPath" Data="M 0,0 6,6 0,6 z" Fill="{DynamicResource Element.Border.Required}" HorizontalAlignment="Left" 
                                  VerticalAlignment="Bottom" Opacity="0" ToolTip="{DynamicResource S.Required}"/>
                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsObligatory" Value="True"/>
                                <Condition Property="Text" Value="{x:Static s:String.Empty}"/>
                            </MultiTrigger.Conditions>

                            <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Element.Border.Required}"/>
                            <Setter Property="Opacity" TargetName="InnerPath" Value="1"/>
                        </MultiTrigger>
                        
                        <Trigger Property="IsReadOnly" Value="True">
                            <Setter Property="Background" TargetName="border" Value="{DynamicResource Element.Background.ReadOnly}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Opacity" TargetName="border" Value="0.7"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Element.Border.Hover}"/>
                            <Setter Property="Fill" TargetName="InnerPath" Value="{DynamicResource Element.Border.Hover}"/>
                        </Trigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsKeyboardFocused" Value="True"/>
                                <Condition Property="IsReadOnly" Value="False"/>
                            </MultiTrigger.Conditions>

                            <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Element.Border.Pressed}"/>
                            <Setter Property="Background" TargetName="border" Value="{DynamicResource Element.Background.Focused}"/>
                            <Setter Property="Fill" TargetName="InnerPath" Value="{DynamicResource Element.Border.Pressed}"/>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>