<Application x:Class="ScreenToGif.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:c="clr-namespace:ScreenToGif.Util.Converters"
             xmlns:n="clr-namespace:ScreenToGif.Controls"
             xmlns:m="clr-namespace:ScreenToGif.Model"
             ShutdownMode="OnExplicitShutdown" Startup="App_Startup" Exit="App_Exit" 
             DispatcherUnhandledException="App_DispatcherUnhandledException">

    <Application.Resources>
        <ResourceDictionary>

            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Resources/Vectors.xaml"/>
                <ResourceDictionary Source="/Resources/Glyphs.xaml"/>
                <ResourceDictionary Source="/Resources/Backgrounds.xaml"/>
                <ResourceDictionary Source="/Resources/Commands.xaml"/>
                <ResourceDictionary Source="/Resources/Settings.xaml"/>

                <!--Themes-->
                <ResourceDictionary Source="/Themes/Colors/VeryDark.xaml"/>
                <ResourceDictionary Source="/Themes/Colors/Dark.xaml"/>
                <ResourceDictionary Source="/Themes/Colors/Medium.xaml"/>
                <ResourceDictionary Source="/Themes/Colors/Light.xaml"/>
                
                <ResourceDictionary Source="/Themes/DataGrid.xaml"/>
                <ResourceDictionary Source="/Themes/Button.xaml"/>
                <ResourceDictionary Source="/Themes/Common.xaml"/>
                <ResourceDictionary Source="/Themes/ComboBox.xaml"/>

                <!--Localizations-->
                <ResourceDictionary Source="/Resources/Localization/StringResources.ar.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.cs.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.da.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.de.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.el.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.es-AR.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.es.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.fr.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.ja.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.hu.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.ko.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.it.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.nl.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.pl.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.pt.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.pt-PT.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.ru.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.sw.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.sv.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.tr.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.uk.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.vi.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.zh.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.zh-Hant.xaml"/>
                <ResourceDictionary Source="/Resources/Localization/StringResources.en.xaml"/>
            </ResourceDictionary.MergedDictionaries>

            <m:ApplicationViewModel x:Key="AppViewModel"/>

            <!--Converter-->
            <BooleanToVisibilityConverter x:Key="Bool2Visibility"/>
            <c:InvertedBoolToVisibility x:Key="InvertedBoolToVisibility"/>
            <c:CountToBool x:Key="CountToBoolConverter"/>
            <c:IntToDecimal x:Key="IntToDecimalConverter"/>
            <c:EnumToInt x:Key="EnumToInt"/>
            <c:ColorToBrush x:Key="ColorToBrushConverter"/>
            <c:ShortcutSelection x:Key="ShortcutSelectionConverter"/>
            <c:IntToVisibility x:Key="IntToVisibility"/>
            <c:InvertedIntToVisibility x:Key="InvertedIntToVisibility"/>
            <c:EnumToVisibility x:Key="EnumToVisibility"/>
            <c:InvertedBool x:Key="InvertedBool"/>
            <c:CommandToInputGestureText x:Key="CommandToInputGestureText"/>
            <c:EnumToBool x:Key="EnumToBool"/>
            <c:InvertedEnumToBool x:Key="InvertedEnumToBool"/>
            <c:BoolAndToVisibility x:Key="BoolAndToVisibility"/>
            <c:ContentToVisibility x:Key="ContentToVisibility"/>
            
            <!--Effects-->
            <DropShadowEffect x:Key="Shadow.Invariant" ShadowDepth="0" Color="Transparent" Opacity="0" BlurRadius="0" RenderingBias="Performance"/>

            <!--Notification Icon-->
            <n:NotifyIcon x:Key="NotifyIcon" IconSource="/Resources/Logo.ico" DataContext="{StaticResource AppViewModel}" NotifyToolTipText="ScreenToGif" Visibility="Collapsed" 
                          LeftClickCommand="{Binding TrayLeftClick}" DoubleLeftClickCommand="{Binding TrayDoubleLeftClick}" MiddleClickCommand="{Binding TrayMiddleClick}">
                <n:NotifyIcon.ContextMenu>
                    <ContextMenu>
                        <n:ExtendedMenuItem Header="{DynamicResource S.NewRecording}" Icon="{StaticResource Vector.Record.New}" Command="{Binding OpenRecorder}" InputGestureText="{Binding RecorderGesture, UpdateSourceTrigger=PropertyChanged}"/>
                        <n:ExtendedMenuItem Header="{DynamicResource S.NewWebcamRecording}" Icon="{StaticResource Vector.Camera.New}" Command="{Binding OpenWebcamRecorder}" InputGestureText="{Binding WebcamRecorderGesture, UpdateSourceTrigger=PropertyChanged}"/>
                        <n:ExtendedMenuItem Header="{DynamicResource S.NewBoardRecording}" Icon="{StaticResource Vector.Board.New}" Command="{Binding OpenBoardRecorder}" InputGestureText="{Binding BoardRecorderGesture, UpdateSourceTrigger=PropertyChanged}"/>
                        <Separator/>
                        <n:ExtendedMenuItem Header="{DynamicResource S.StartUp.Editor}" Icon="{StaticResource Vector.Editor}" Command="{Binding OpenEditor}" InputGestureText="{Binding EditorGesture, UpdateSourceTrigger=PropertyChanged}"/>
                        <n:ExtendedMenuItem Header="{DynamicResource S.StartUp.Options}" Icon="{StaticResource Vector.Options}" Command="{Binding OpenOptions}" InputGestureText="{Binding OptionsGesture, UpdateSourceTrigger=PropertyChanged}"/>
                        <n:ExtendedMenuItem Header="{DynamicResource S.Feedback.Feedback}" Icon="{StaticResource Vector.Application}" Command="{Binding OpenFeedback}"/>
                        <n:ExtendedMenuItem Header="{DynamicResource S.Troubleshoot.Title}" Icon="{StaticResource Vector.Warning}" Command="{Binding OpenTroubleshoot}"/>
                        <Separator/>
                        <n:ExtendedMenuItem x:Name="ExitButton" Header="{DynamicResource S.Exit}" Icon="{StaticResource Vector.Close}" Command="{Binding ExitApplication}" 
                                            InputGestureText="{Binding ExitGesture, UpdateSourceTrigger=PropertyChanged}"/>
                    </ContextMenu>
                </n:NotifyIcon.ContextMenu>
            </n:NotifyIcon>

            <Style x:Key="Style.FocusVisual.NoMargin">
                <Setter Property="Control.Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Border>
                                <Rectangle Margin="0" SnapsToDevicePixels="True" Stroke="{DynamicResource Element.Foreground}" StrokeThickness="1" StrokeDashArray="1,2"/>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>


            <!--RadioButton-->
            <Style TargetType="{x:Type RadioButton}">
                <Setter Property="FocusVisualStyle" Value="{StaticResource Style.FocusVisual.NoMargin}"/>
                <Setter Property="Background" Value="{DynamicResource Element.Background}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource Element.Border}"/>
                <Setter Property="Foreground" Value="{DynamicResource Element.Foreground.Medium}"/>
                <Setter Property="HorizontalContentAlignment" Value="Left"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>
                <Setter Property="Padding" Value="2,0,0,0"/>
                <Setter Property="BorderThickness" Value="1"/>

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

                                <Border x:Name="radioButtonBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" 
                                        Background="{TemplateBinding Background}" CornerRadius="100" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                        Margin="1,1,2,1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                                    <Grid x:Name="markGrid" Margin="2">
                                        <Ellipse x:Name="optionMark" Fill="{DynamicResource Element.Glyph}" MinWidth="6" MinHeight="6" Opacity="0"/>
                                    </Grid>
                                </Border>

                                <ContentPresenter x:Name="contentPresenter" Grid.Column="1" Focusable="False" 
                                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" 
                                                  RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            </Grid>

                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Background" TargetName="radioButtonBorder" Value="{DynamicResource Element.Background.Hover}"/>
                                    <Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="{DynamicResource Element.Border.Hover}"/>
                                    <Setter Property="Fill" TargetName="optionMark" Value="{DynamicResource Element.Glyph.Hover}"/>
                                </Trigger>
                                <Trigger Property="IsPressed" Value="True">
                                    <Setter Property="Background" TargetName="radioButtonBorder" Value="{DynamicResource Element.Background.Pressed}"/>
                                    <Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="{DynamicResource Element.Border.Pressed}"/>
                                    <Setter Property="Fill" TargetName="optionMark" Value="{DynamicResource Element.Glyph.Pressed}"/>
                                </Trigger>
                                <Trigger Property="IsChecked" Value="True">
                                    <Setter Property="Opacity" TargetName="optionMark" Value="1"/>
                                </Trigger>
                                <Trigger Property="IsChecked" Value="{x:Null}">
                                    <Setter Property="Opacity" TargetName="optionMark" Value="0.56"/>
                                </Trigger>
                                <Trigger Property="IsEnabled" Value="False">
                                    <Setter Property="Opacity" Value="0.6"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!--ToolTip-->
            <Style TargetType="{x:Type ToolTip}">
                <Setter Property="Foreground" Value="{DynamicResource Element.Foreground.Medium}"/>
                <Setter Property="Background" Value="{DynamicResource Element.Background}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource Element.Border}"/>
                <Setter Property="MinWidth" Value="20"/>
                <Setter Property="SnapsToDevicePixels" Value="True"/>
                <Setter Property="Effect" Value="{DynamicResource Shadow.Border.Dark}"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ToolTip}">
                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" Margin="2" Background="{TemplateBinding Background}" Padding="5" TextBlock.Foreground="{TemplateBinding Foreground}">
                                <ContentPresenter Content="{TemplateBinding Content}" Width="Auto" HorizontalAlignment="Center" TextBlock.Foreground="{TemplateBinding Foreground}"/>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!--ContextMenu-->
            <Style TargetType="{x:Type ContextMenu}">
                <Setter Property="SnapsToDevicePixels" Value="True"/>
                <Setter Property="OverridesDefaultStyle" Value="True"/>
                <Setter Property="Grid.IsSharedSizeScope" Value="True"/>
                <Setter Property="Placement" Value="Bottom"/>
                <Setter Property="HorizontalOffset" Value="-5"/>
                <Setter Property="Effect" Value="{DynamicResource Shadow.Border.Dark}"/>
                <Setter Property="Background" Value="{DynamicResource Element.Background}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource Element.Border}"/>
                <Setter Property="Foreground" Value="{DynamicResource Element.Foreground.Medium}"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ContextMenu}">
                            <Border x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" Margin="2" Background="{TemplateBinding Background}">
                                <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle"/>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!-- Separator-->
            <Style TargetType="{x:Type Separator}">
                <Setter Property="BorderBrush" Value="{DynamicResource Element.Border.Light}"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Separator}">
                            <Rectangle Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" Fill="{TemplateBinding BorderBrush}"/>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!--LabelSeparator-->
            <Style x:Key="LabelSeparator" TargetType="{x:Type Label}">
                <Setter Property="Height" Value="Auto" />
                <Setter Property="Padding" Value="3,1"/>
                <Setter Property="BorderBrush" Value="{DynamicResource Element.Border.Light}"/>
                <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>
                <Setter Property="BorderThickness" Value="1"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Label}">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>

                                <Label Padding="{TemplateBinding Padding}" Foreground="{TemplateBinding Foreground}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" 
                                       ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}"
                                       ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" Content="{TemplateBinding Content}"/>

                                <Rectangle Grid.Column="1" Height="{TemplateBinding BorderThickness}" Fill="{TemplateBinding BorderBrush}" VerticalAlignment="Center" Margin="5,0,0,0"/>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!--ScrollBar Styles-->
            <Style x:Key="ScrollBar.Button" TargetType="{x:Type RepeatButton}">
                <Setter Property="OverridesDefaultStyle" Value="True"/>
                <Setter Property="Focusable" Value="False"/>
                <Setter Property="IsTabStop" Value="False"/>
                <Setter Property="FocusVisualStyle" Value="{x:Null}"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type RepeatButton}">
                            <Grid x:Name="Root" Margin="0">
                                <Border x:Name="BackgroundBorder" Background="{DynamicResource Brush.ScrollBar.Background}" BorderBrush="{DynamicResource Brush.ScrollBar.Border}" BorderThickness="1"/>
                                <Path x:Name="Arrow" Stretch="None" Data="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" Fill="{DynamicResource Element.Glyph}" 
                                      HorizontalAlignment="Center" VerticalAlignment="Center" SnapsToDevicePixels="True"/>
                            </Grid>

                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter TargetName="BackgroundBorder" Property="Background" Value="{DynamicResource Brush.ScrollBar.Background.Hover}"/>
                                    <Setter TargetName="BackgroundBorder" Property="BorderBrush" Value="{DynamicResource Brush.ScrollBar.Border.Hover}"/>
                                    <Setter TargetName="Arrow" Property="Fill" Value="{DynamicResource Element.Glyph.Hover}"/>
                                </Trigger>
                                <Trigger Property="IsPressed" Value="True">
                                    <Setter TargetName="BackgroundBorder" Property="Background" Value="{DynamicResource Brush.ScrollBar.Background.Pressed}"/>
                                    <Setter TargetName="BackgroundBorder" Property="BorderBrush" Value="{DynamicResource Brush.ScrollBar.Border.Pressed}"/>
                                    <Setter TargetName="Arrow" Property="Fill" Value="{DynamicResource Element.Glyph.Pressed}"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="ScrollBar.Thumb" TargetType="{x:Type Thumb}">
                <Setter Property="SnapsToDevicePixels" Value="True"/>
                <Setter Property="Focusable" Value="False"/>
                <Setter Property="IsTabStop" Value="False"/>
                <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                <Setter Property="Background" Value="{DynamicResource Brush.ScrollBar.Background}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource Brush.ScrollBar.Border}"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Thumb}">
                            <Grid Background="Transparent">
                                <Border Background="{TemplateBinding Background}" Margin="{TemplateBinding Padding}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1"/>
                            </Grid>

                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Background" Value="{DynamicResource Brush.ScrollBar.Background.Hover}"/>
                                    <Setter Property="BorderBrush" Value="{DynamicResource Brush.ScrollBar.Border.Hover}"/>
                                </Trigger>
                                <Trigger Property="IsDragging" Value="True">
                                    <Setter Property="Background" Value="{DynamicResource Brush.ScrollBar.Background.Pressed}"/>
                                    <Setter Property="BorderBrush" Value="{DynamicResource Brush.ScrollBar.Border.Pressed}"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="ScrollBar.Transparent" TargetType="{x:Type RepeatButton}">
                <Setter Property="OverridesDefaultStyle" Value="True"/>
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="Focusable" Value="False"/>
                <Setter Property="IsTabStop" Value="False"/>
                <Setter Property="FocusVisualStyle" Value="{x:Null}"/>

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

            <Style TargetType="{x:Type ScrollBar}">
                <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"/>
                <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
                <Setter Property="Background" Value="{DynamicResource Brush.ScrollBar.Background.Back}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource Brush.ScrollBar.Background.Back}"/>
                <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>
                <Setter Property="BorderThickness" Value="1,0"/>
                <Setter Property="Width" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
                <Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ScrollBar}">
                            <Grid x:Name="Bg" SnapsToDevicePixels="True">
                                <Grid.RowDefinitions>
                                    <RowDefinition MaxHeight="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/>
                                    <RowDefinition Height="0.00001*"/>
                                    <RowDefinition MaxHeight="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/>
                                </Grid.RowDefinitions>

                                <RepeatButton Grid.Row="0" x:Name="PART_LineUpButton" Command="{x:Static ScrollBar.LineUpCommand}" IsEnabled="{TemplateBinding IsMouseOver}" Style="{StaticResource ScrollBar.Button}" 
                                              Content="M 0,4 C0,4 0,6 0,6 0,6 3.5,2.5 3.5,2.5 3.5,2.5 7,6 7,6 7,6 7,4 7,4 7,4 3.5,0.5 3.5,0.5 3.5,0.5 0,4 0,4 z"/>

                                <Border Grid.Row="1" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"/>
                                <Track Grid.Row="1" x:Name="PART_Track" IsDirectionReversed="True" IsEnabled="{TemplateBinding IsMouseOver}">
                                    <Track.DecreaseRepeatButton>
                                        <RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Style="{StaticResource ScrollBar.Transparent}"/>
                                    </Track.DecreaseRepeatButton>
                                    <Track.IncreaseRepeatButton>
                                        <RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Style="{StaticResource ScrollBar.Transparent}"/>
                                    </Track.IncreaseRepeatButton>
                                    <Track.Thumb>
                                        <Thumb Style="{StaticResource ScrollBar.Thumb}"/>
                                    </Track.Thumb>
                                </Track>

                                <RepeatButton Grid.Row="2" x:Name="PART_LineDownButton" Command="{x:Static ScrollBar.LineDownCommand}" IsEnabled="{TemplateBinding IsMouseOver}" Style="{StaticResource ScrollBar.Button}" 
                                              Content="M 0,2.5 C0,2.5 0,0.5 0,0.5 0,0.5 3.5,4 3.5,4 3.5,4 7,0.5 7,0.5 7,0.5 7,2.5 7,2.5 7,2.5 3.5,6 3.5,6 3.5,6 0,2.5 0,2.5 z"/>
                            </Grid>
                            
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsEnabled" Value="False">
                                    <Setter TargetName="Bg" Property="Opacity" Value="0.6"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>

                <Style.Triggers>
                    <Trigger Property="Orientation" Value="Horizontal">
                        <Setter Property="Width" Value="Auto"/>
                        <Setter Property="MinWidth" Value="0"/>
                        <Setter Property="Height" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
                        <Setter Property="MinHeight" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
                        <Setter Property="BorderThickness" Value="0,1"/>

                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ScrollBar}">
                                    <Grid x:Name="Bg" SnapsToDevicePixels="True">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
                                            <ColumnDefinition Width="0.00001*"/>
                                            <ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
                                        </Grid.ColumnDefinitions>

                                        <RepeatButton Grid.Column="0" x:Name="PART_LineLeftButton" Command="{x:Static ScrollBar.LineLeftCommand}" IsEnabled="{TemplateBinding IsMouseOver}" Style="{StaticResource ScrollBar.Button}" 
                                                      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" />

                                        <Border Grid.Column="1" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"/>
                                        <Track Grid.Column="1" x:Name="PART_Track" IsEnabled="{TemplateBinding IsMouseOver}">
                                            <Track.DecreaseRepeatButton>
                                                <RepeatButton Command="{x:Static ScrollBar.PageLeftCommand}" Style="{StaticResource ScrollBar.Transparent}"/>
                                            </Track.DecreaseRepeatButton>
                                            <Track.IncreaseRepeatButton>
                                                <RepeatButton Command="{x:Static ScrollBar.PageRightCommand}" Style="{StaticResource ScrollBar.Transparent}"/>
                                            </Track.IncreaseRepeatButton>
                                            <Track.Thumb>
                                                <Thumb Style="{StaticResource ScrollBar.Thumb}"/>
                                            </Track.Thumb>
                                        </Track>

                                        <RepeatButton Grid.Column="2" x:Name="PART_LineRightButton" Command="{x:Static ScrollBar.LineRightCommand}" IsEnabled="{TemplateBinding IsMouseOver}" Style="{StaticResource ScrollBar.Button}" 
                                                      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="IsEnabled" Value="False">
                                            <Setter TargetName="Bg" Property="Opacity" Value="0.6"/>
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Trigger>
                </Style.Triggers>
            </Style>

            <!--ScrollViewer-->
            <Style TargetType="{x:Type ScrollViewer}">
                <!--<Setter Property="PanningRatio" Value="0.01"/>
                <Setter Property="PanningDeceleration" Value="0.1"/>
                <Setter Property="CanContentScroll" Value="True"/>-->

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

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

                                <ScrollBar Grid.Row="0" Grid.Column="1" x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow"
                                           Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" 
                                           Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>

                                <Rectangle Grid.Row="1" Grid.Column="1" x:Name="Corner" Fill="{DynamicResource Element.Background.Back}"/>

                                <ScrollBar Grid.Row="1" Grid.Column="0" x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" 
                                           Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" 
                                           Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
                            </Grid>

                            <ControlTemplate.Triggers>
                                <Trigger Property="IsEnabled" Value="False">
                                    <Setter TargetName="Corner" Property="Opacity" Value="0.6"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!--Expander Style-->
            <Style x:Key="ExpanderRightHeaderStyle" TargetType="{x:Type ToggleButton}">
                <Setter Property="Padding" Value="0"/>
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="HorizontalContentAlignment" Value="Center"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ToggleButton}">
                            <Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" >
                                <Grid SnapsToDevicePixels="False">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="*"/>
                                        <RowDefinition Height="19"/>
                                    </Grid.RowDefinitions>

                                    <Label Grid.Row="0" Content="{TemplateBinding Content}" Padding="{TemplateBinding Padding}" Foreground="{TemplateBinding Foreground}"
                                           HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"/>

                                    <Rectangle Grid.Row="1" x:Name="HorizontalRectangle" MinHeight="1" Fill="{DynamicResource Element.Border.Light}" 
                                               Height="Auto" HorizontalAlignment="Center" Margin="3,0,3,0"/>

                                    <Path Grid.Row="2" x:Name="ArrowPath" Data="M 1,1  L 4.5,4.5  L 1,8" HorizontalAlignment="Center" SnapsToDevicePixels="False" 
                                          Stroke="{DynamicResource Element.Glyph}" StrokeThickness="2" VerticalAlignment="Center"/>
                                </Grid>
                            </Border>

                            <ControlTemplate.Triggers>
                                <Trigger Property="IsChecked" Value="True">
                                    <Setter Property="Data" TargetName="ArrowPath" Value="M 4.5,1  L 1,4.5  L 4.5,8"/>
                                </Trigger>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Cursor" Value="Hand"/>
                                    <Setter Property="Background" Value="{DynamicResource Element.Background.Hover}"/>
                                    <Setter Property="Stroke" TargetName="HorizontalRectangle" Value="{DynamicResource Element.Border.Hover}"/>
                                    <Setter Property="Stroke" TargetName="ArrowPath" Value="{DynamicResource Element.Glyph.Hover}"/>
                                </Trigger>
                                <Trigger Property="IsPressed" Value="True">
                                    <Setter Property="Stroke" TargetName="HorizontalRectangle" Value="{DynamicResource Element.Border.Pressed}"/>
                                    <Setter Property="Background" Value="{DynamicResource Element.Background.Focused}"/>
                                    <Setter Property="Stroke" TargetName="ArrowPath" Value="{DynamicResource Element.Glyph.Pressed}"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="ExpanderLeftHeaderStyle" TargetType="{x:Type ToggleButton}">
                <Setter Property="Padding" Value="0"/>
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="HorizontalContentAlignment" Value="Center"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ToggleButton}">
                            <Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" >
                                <Grid SnapsToDevicePixels="False">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="*"/>
                                        <RowDefinition Height="19"/>
                                    </Grid.RowDefinitions>

                                    <Label Grid.Row="0" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}"
                                           HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"/>

                                    <Rectangle Grid.Row="1" x:Name="HorizontalRectangle" MinHeight="1" Fill="{DynamicResource Element.Border.Light}" 
                                               Height="Auto" HorizontalAlignment="Center" Margin="3,0,3,0"/>

                                    <Path Grid.Row="2" x:Name="ArrowPath" Data="M 4.5,1  L 1,4.5  L 4.5,8" HorizontalAlignment="Center" SnapsToDevicePixels="False" 
                                          Stroke="{DynamicResource Element.Glyph}" StrokeThickness="2" VerticalAlignment="Center"/>
                                </Grid>
                            </Border>

                            <ControlTemplate.Triggers>
                                <Trigger Property="IsChecked" Value="True">
                                    <Setter Property="Data" TargetName="ArrowPath" Value="M 1,1  L 4.5,4.5  L 1,8"/>
                                </Trigger>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Cursor" Value="Hand"/>
                                    <Setter Property="Background" Value="{DynamicResource Element.Background.Hover}"/>
                                    <Setter Property="Stroke" TargetName="HorizontalRectangle" Value="{DynamicResource Element.Border.Hover}"/>
                                    <Setter Property="Stroke" TargetName="ArrowPath" Value="{DynamicResource Element.Glyph.Hover}"/>
                                </Trigger>
                                <Trigger Property="IsPressed" Value="True">
                                    <Setter Property="Stroke" TargetName="HorizontalRectangle" Value="{DynamicResource Element.Border.Pressed}"/>
                                    <Setter Property="Background" Value="{DynamicResource Element.Background.Focused}"/>
                                    <Setter Property="Stroke" TargetName="ArrowPath" Value="{DynamicResource Element.Glyph.Pressed}"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="ExpanderUpHeaderStyle" TargetType="{x:Type ToggleButton}">
                <Setter Property="Height" Value="27"/>
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ToggleButton}">
                            <Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" >
                                <Grid SnapsToDevicePixels="False">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="19"/>
                                    </Grid.ColumnDefinitions>

                                    <Label Grid.Column="0" Content="{TemplateBinding Content}" Padding="3" Foreground="{TemplateBinding Foreground}"
                                           VerticalContentAlignment="Center"/>

                                    <Rectangle Grid.Column="1" x:Name="HorizontalRectangle" MinHeight="1" Fill="{DynamicResource Element.Border.Light}" 
                                               Height="Auto" VerticalAlignment="Center" Margin="3,0,3,0"/>

                                    <Path Grid.Column="2" x:Name="ArrowPath" Data="M 1,4.5 L 4.5,1 L 8,4.5" HorizontalAlignment="Center" SnapsToDevicePixels="False" 
                                          Stroke="{DynamicResource Element.Glyph}" StrokeThickness="2" VerticalAlignment="Center"/>
                                </Grid>
                            </Border>

                            <ControlTemplate.Triggers>
                                <Trigger Property="IsChecked" Value="True">
                                    <Setter Property="Data" TargetName="ArrowPath" Value="M 1,1.5 L 4.5,5 L 8,1.5"/>
                                </Trigger>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Cursor" Value="Hand"/>
                                    <Setter Property="Background" Value="{DynamicResource Element.Background.Hover}"/>
                                    <Setter Property="Stroke" TargetName="HorizontalRectangle" Value="{DynamicResource Element.Border.Hover}"/>
                                    <Setter Property="Stroke" TargetName="ArrowPath" Value="{DynamicResource Element.Glyph.Hover}"/>
                                </Trigger>
                                <Trigger Property="IsPressed" Value="True">
                                    <Setter Property="Stroke" TargetName="HorizontalRectangle" Value="{DynamicResource Element.Border.Pressed}"/>
                                    <Setter Property="Background" Value="{DynamicResource Element.Background.Focused}"/>
                                    <Setter Property="Stroke" TargetName="ArrowPath" Value="{DynamicResource Element.Glyph.Pressed}"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="ExpanderDownHeaderStyle" TargetType="{x:Type ToggleButton}">
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ToggleButton}">
                            <Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" >
                                <Grid SnapsToDevicePixels="False">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="19"/>
                                    </Grid.ColumnDefinitions>

                                    <Label Grid.Column="0" Content="{TemplateBinding Content}" Padding="3" Foreground="{TemplateBinding Foreground}"
                                           VerticalContentAlignment="Center"/>

                                    <Rectangle Grid.Column="1" x:Name="HorizontalRectangle" MinHeight="1" Fill="{DynamicResource Element.Border.Light}" 
                                               Height="Auto" VerticalAlignment="Center" Margin="3,0,3,0"/>

                                    <Path Grid.Column="2" x:Name="ArrowPath" Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="False" 
                                          Stroke="{DynamicResource Element.Glyph}" StrokeThickness="2" VerticalAlignment="Center"/>
                                </Grid>
                            </Border>

                            <ControlTemplate.Triggers>
                                <Trigger Property="IsChecked" Value="True">
                                    <Setter Property="Data" TargetName="ArrowPath" Value="M 1,4.5 L 4.5,1 L 8,4.5"/>
                                </Trigger>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Cursor" Value="Hand"/>
                                    <Setter Property="Background" Value="{DynamicResource Element.Background.Hover}"/>
                                    <Setter Property="Stroke" TargetName="HorizontalRectangle" Value="{DynamicResource Element.Border.Hover}"/>
                                    <Setter Property="Stroke" TargetName="ArrowPath" Value="{DynamicResource Element.Glyph.Hover}"/>
                                </Trigger>
                                <Trigger Property="IsPressed" Value="True">
                                    <Setter Property="Stroke" TargetName="HorizontalRectangle" Value="{DynamicResource Element.Border.Pressed}"/>
                                    <Setter Property="Background" Value="{DynamicResource Element.Background.Focused}"/>
                                    <Setter Property="Stroke" TargetName="ArrowPath" Value="{DynamicResource Element.Glyph.Pressed}"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style TargetType="{x:Type Expander}">
                <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                <Setter Property="VerticalContentAlignment" Value="Stretch"/>
                <Setter Property="BorderBrush" Value="Transparent"/>
                <Setter Property="BorderThickness" Value="0"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Expander}">
                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                                <DockPanel>
                                    <ToggleButton x:Name="HeaderSite" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" 
                                                  Content="{TemplateBinding Header}" DockPanel.Dock="Top" Foreground="{TemplateBinding Foreground}" FontWeight="{TemplateBinding FontWeight}" 
                                                  FocusVisualStyle="{StaticResource Style.FocusVisual.NoMargin}" FontStyle="{TemplateBinding FontStyle}" FontStretch="{TemplateBinding FontStretch}" 
                                                  FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                                  IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="0"
                                                  Padding="{TemplateBinding Padding}" Style="{StaticResource ExpanderDownHeaderStyle}" 
                                                  VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>

                                    <ContentPresenter x:Name="ExpandSite" DockPanel.Dock="Bottom" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                                      Margin="{TemplateBinding Padding}" Visibility="Collapsed" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                </DockPanel>
                            </Border>

                            <ControlTemplate.Triggers>
                                <Trigger Property="IsExpanded" Value="True">
                                    <Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
                                </Trigger>
                                <Trigger Property="ExpandDirection" Value="Right">
                                    <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Right"/>
                                    <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Left"/>
                                    <Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderRightHeaderStyle}"/>
                                </Trigger>
                                <Trigger Property="ExpandDirection" Value="Up">
                                    <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Top"/>
                                    <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Bottom"/>
                                    <Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderUpHeaderStyle}"/>
                                </Trigger>
                                <Trigger Property="ExpandDirection" Value="Left">
                                    <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Left"/>
                                    <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Right"/>
                                    <Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderLeftHeaderStyle}"/>
                                </Trigger>
                                <Trigger Property="IsEnabled" Value="False">
                                    <Setter TargetName="HeaderSite" Property="Opacity" Value="0.6"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!--Slider-->
            <Style TargetType="{x:Type Slider}">
                <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="Slider">
                            <Grid x:Name="Root">
                                <Grid x:Name="HorizontalTemplate">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}"/>
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>

                                    <TickBar x:Name="TopTick" Grid.Row="0" Fill="{TemplateBinding BorderBrush}" TickFrequency="1" Height="4" Margin="0,0,0,2" Placement="Top" Visibility="Collapsed"/>
                                    <TickBar x:Name="BottomTick" Grid.Row="2" Fill="{TemplateBinding BorderBrush}" TickFrequency="1" Height="4" Margin="0,1,0,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">
                                        <Canvas Margin="-6,-1">
                                            <Rectangle x:Name="PART_SelectionRange" Fill="{DynamicResource Brush.ProgressBar.Info}" Height="4.0" Visibility="Hidden"/>
                                        </Canvas>
                                    </Border>

                                    <Track Grid.Row="1" x:Name="PART_Track">
                                        <Track.DecreaseRepeatButton>
                                            <RepeatButton x:Name="HorizontalTrackLargeChangeDecreaseRepeatButton" Template="{StaticResource Template.RepeatButton.Simple}" Background="Transparent" IsTabStop="False"/>
                                        </Track.DecreaseRepeatButton>
                                        <Track.IncreaseRepeatButton>
                                            <RepeatButton x:Name="HorizontalTrackLargeChangeIncreaseRepeatButton" Template="{StaticResource Template.RepeatButton.Simple}" Background="Transparent" IsTabStop="False"/>
                                        </Track.IncreaseRepeatButton>

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

                            <ControlTemplate.Triggers>
                                <Trigger Property="TickPlacement" Value="BottomRight">
                                    <Setter TargetName="HorizontalThumb" Property="Template" Value="{StaticResource Template.Slider.Thumb.Bottom}"/>
                                    <Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
                                </Trigger>
                                <Trigger Property="TickPlacement" Value="TopLeft">
                                    <Setter TargetName="HorizontalThumb" Property="Template" Value="{StaticResource Template.Slider.Thumb.Top}"/>
                                    <Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
                                </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" Value="0.7"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!--Hyperlink-->
            <Style x:Key="{x:Type Hyperlink}" TargetType="{x:Type Hyperlink}">
                <Setter Property="Foreground" Value="{DynamicResource Brush.Hyperlink}"/>
                <Setter Property="TextDecorations" Value="Underline"/>

                <Style.Triggers>
                    <Trigger Property="IsMouseOver" Value="True">
                        <Setter Property="Foreground" Value="{DynamicResource Brush.Hyperlink.Hover}"/>
                    </Trigger>
                    <Trigger Property="IsEnabled" Value="False">
                        <Setter Property="Foreground" Value="{DynamicResource Brush.Hyperlink.Disabled}"/>
                    </Trigger>
                    <Trigger Property="IsEnabled" Value="True">
                        <Setter Property="Cursor" Value="Hand"/>
                    </Trigger>
                </Style.Triggers>
            </Style>

            <!--ProgressBar-->
            <Style TargetType="{x:Type ProgressBar}">
                <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 ProgressBar}">
                            <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">
                                        <Rectangle.RenderTransform>
                                            <TransformGroup>
                                                <ScaleTransform/>
                                                <SkewTransform/>
                                                <RotateTransform/>
                                                <TranslateTransform/>
                                            </TransformGroup>
                                        </Rectangle.RenderTransform>
                                    </Rectangle>
                                </Grid>
                            </Grid>

                            <ControlTemplate.Triggers>
                                <Trigger Property="Orientation" Value="Vertical">
                                    <Setter Property="LayoutTransform" TargetName="TemplateRoot">
                                        <Setter.Value>
                                            <RotateTransform Angle="-90"/>
                                        </Setter.Value>
                                    </Setter>
                                </Trigger>
                                <Trigger Property="IsIndeterminate" Value="True">
                                    <Setter Property="Visibility" TargetName="Indicator" Value="Collapsed"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!--ListBox-->
            <Style TargetType="{x:Type ListBox}">
                <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>
                <Setter Property="Background" Value="{DynamicResource Element.Background}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource Element.Border}"/>
                <Setter Property="BorderThickness" Value="1"/>
                <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
                <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
                <Setter Property="ScrollViewer.CanContentScroll" Value="True"/>
                <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
                <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ListBox}">
                            <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="1" SnapsToDevicePixels="True">
                                <ScrollViewer Focusable="False" Padding="{TemplateBinding Padding}">
                                    <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                </ScrollViewer>
                            </Border>

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

                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsGrouping" Value="True"/>
                                        <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="False"/>
                                    </MultiTrigger.Conditions>

                                    <Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
                                </MultiTrigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!--ListView-->
            <Style TargetType="{x:Type ListView}">
                <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>
                <Setter Property="Background" Value="{DynamicResource Element.Background}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource Element.Border}"/>
                <Setter Property="BorderThickness" Value="1"/>
                <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
                <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
                <Setter Property="ScrollViewer.CanContentScroll" Value="True"/>
                <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
                <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ListView}">
                            <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="1" SnapsToDevicePixels="True">
                                <ScrollViewer Focusable="False" Padding="{TemplateBinding Padding}">
                                    <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                </ScrollViewer>
                            </Border>

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

                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsGrouping" Value="True"/>
                                        <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="False"/>
                                    </MultiTrigger.Conditions>

                                    <Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
                                </MultiTrigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!--ComboBoxItem-->
            <Style TargetType="{x:Type ComboBoxItem}">
                <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="{StaticResource Style.FocusVisual.NoMargin}"/>
                <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ComboBoxItem}">
                            <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" 
                                    Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}">
                                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            </Border>

                            <ControlTemplate.Triggers>
                                <Trigger Property="IsEnabled" Value="False">
                                    <Setter Property="Opacity" TargetName="Bd" Value="0.7"/>
                                </Trigger>

                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsSelected" Value="False"/>
                                        <Condition Property="IsMouseOver" Value="True"/>
                                        <Condition Property="IsKeyboardFocused" Value="False"/>
                                    </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="IsSelected" Value="True"/>
                                        <Condition Property="IsMouseOver" Value="False"/>
                                        <Condition Property="IsKeyboardFocused" 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="IsSelected" Value="True"/>
                                        <Condition Property="IsMouseOver" 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="IsSelected" Value="True"/>
                                        <Condition Property="IsMouseOver" Value="False"/>
                                        <Condition Property="IsKeyboardFocused" Value="False"/>
                                    </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="IsSelected" Value="False"/>
                                        <Condition Property="IsMouseOver" Value="False"/>
                                        <Condition Property="IsKeyboardFocused" Value="True"/>
                                    </MultiTrigger.Conditions>
                                    <Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource Item.MouseOver.Border}"/>
                                </MultiTrigger>

                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsSelected" Value="False"/>
                                        <Condition Property="IsMouseOver" Value="True"/>
                                        <Condition Property="IsKeyboardFocused" 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>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!--PasswordBox Style-->
            <Style TargetType="{x:Type PasswordBox}">
                <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 PasswordBox}">
                            <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}"/>
                                </Grid>
                            </Border>

                            <ControlTemplate.Triggers>
                                <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}"/>
                                </Trigger>

                                <Trigger Property="IsKeyboardFocused" Value="True">
                                    <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Element.Border.Pressed}"/>
                                    <Setter Property="Background" TargetName="border" Value="{DynamicResource Element.Background.Focused}"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!--Custom styles-->

            <!--ListView - Frames-->
            <Style x:Key="Style.ListView.Frames" TargetType="{x:Type ListView}">
                <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="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
                <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
                <Setter Property="ScrollViewer.CanContentScroll" Value="True"/>
                <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
                <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>

                <Setter Property="ItemsPanel">
                    <Setter.Value>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel Orientation="Horizontal" MinHeight="0" VirtualizationMode="Recycling" IsVirtualizing="True"/>
                        </ItemsPanelTemplate>
                    </Setter.Value>
                </Setter>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ListView}">
                            <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="2" SnapsToDevicePixels="True">
                                <ScrollViewer Focusable="False" Padding="{TemplateBinding Padding}" CanContentScroll="True">
                                    <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                </ScrollViewer>
                            </Border>

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

                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsGrouping" Value="True"/>
                                        <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="False"/>
                                    </MultiTrigger.Conditions>

                                    <Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
                                </MultiTrigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!--Integer Up/Down - Minimal-->
            <Style x:Key="IntegerUpDown.Minimal" TargetType="{x:Type n:IntegerUpDown}">
                <Setter Property="VerticalContentAlignment" Value="Center"/>
                <Setter Property="HorizontalContentAlignment" Value="Center"/>
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="Foreground" Value="{DynamicResource Element.Foreground}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource Element.Border}"/>
                <Setter Property="BorderThickness" Value="0"/>

                <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/>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="55*" MinWidth="24"/>
                                        <ColumnDefinition x:Name="SecondColumn" Width="45*" MinWidth="18" MaxWidth="25"/>
                                    </Grid.ColumnDefinitions>

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

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

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

                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Background" Value="{DynamicResource Element.Background}"/>
                                </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.6"/>
                    </Trigger>
                </Style.Triggers>
            </Style>

            <!--Round Thumb-->
            <Style x:Key="Style.Thumb.Ellipse" TargetType="{x:Type Thumb}">
                <Setter Property="SnapsToDevicePixels" Value="True"/>
                <Setter Property="IsTabStop" Value="False"/>
                <Setter Property="Focusable" Value="False"/>
                <Setter Property="Background" Value="{DynamicResource Element.Background}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource Element.Border}"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Thumb}">
                            <Grid Background="Transparent">
                                <Ellipse Fill="{TemplateBinding Background}" Margin="{TemplateBinding Padding}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1"/>
                            </Grid>

                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Background" Value="{DynamicResource Element.Background.Hover}"/>
                                    <Setter Property="BorderBrush" Value="{DynamicResource Element.Border.Hover}"/>
                                </Trigger>
                                <Trigger Property="IsDragging" Value="True">
                                    <Setter Property="Background" Value="{DynamicResource Element.Background.Focused}"/>
                                    <Setter Property="BorderBrush" Value="{DynamicResource Element.Border.Pressed}"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!--Viewbox-->
            <Style x:Key="Style.ViewBox" TargetType="{x:Type Viewbox}">
                <Setter Property="Opacity" Value="{DynamicResource Element.Opacity}"/>

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

            <!--Transparent Thumb Style, used by the cropping adorner-->
            <Style x:Key="ThumbTranparent" TargetType="{x:Type Thumb}">
                <Setter Property="SnapsToDevicePixels" Value="True"/>
                <Setter Property="IsTabStop" Value="False"/>
                <Setter Property="Focusable" Value="False"/>
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="BorderBrush" Value="Transparent"/>
                <Setter Property="BorderThickness" Value="0"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Thumb}">
                            <Grid Background="Transparent">
                                <Border Background="{TemplateBinding Background}" Margin="{TemplateBinding Padding}"
                                        BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" />
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Cursor" Value="SizeAll"/>
                                </Trigger>
                                <Trigger Property="IsDragging" Value="True">
                                    <Setter Property="Background" Value="#10000000"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </ResourceDictionary>
    </Application.Resources>
</Application>