<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:sys="clr-namespace:System;assembly=mscorlib"
                    xmlns:controls="clr-namespace:Reloaded.WPF.Controls;assembly=Reloaded.WPF">


    <!-- Import Reloaded.WPF Theme at runtime. -->
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>

                <!-- Copied from pack://siteoforigin:,,,/Theme/Default/Root.xaml -->
                <controls:SharedResourceDictionary Source="pack://siteoforigin:,,,/Theme/Default/Fonts.xaml"/>
                <controls:SharedResourceDictionary Source="pack://siteoforigin:,,,/Theme/Default/Settings.xaml"/>

                <!-- But Using our own Styles & Colours Instead -->
                <controls:SharedResourceDictionary Source="pack://siteoforigin:,,,/Theme/Halogen/Styles.xaml"/>
                <controls:SharedResourceDictionary Source="pack://siteoforigin:,,,/Theme/Halogen/Colours.xaml"/>

            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </ResourceDictionary.MergedDictionaries>

    <!-- Textblock with colour change on hover -->
    <Style x:Key="TextblockWithColourChange" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource BaseTextBlockStyle}">
        <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
        <Setter Property="FocusVisualStyle" Value="{DynamicResource ReloadedFocusVisual}"/>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Trigger.EnterActions>
                    <BeginStoryboard Storyboard="{StaticResource ForegroundFadeTextToAccentLightest}"/>
                </Trigger.EnterActions>
                <Trigger.ExitActions>
                    <BeginStoryboard Storyboard="{StaticResource ForegroundFadeAccentLightestToText}"/>
                </Trigger.ExitActions>
            </Trigger>
        </Style.Triggers>
    </Style>

    <!-- PopupLabel with colour change on hover -->
    <Style x:Key="PopupLabelWithColourChange" TargetType="{x:Type UserControl}">
        <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Trigger.EnterActions>
                    <BeginStoryboard Storyboard="{StaticResource ForegroundFadeTextToAccentLightest}"/>
                </Trigger.EnterActions>
                <Trigger.ExitActions>
                    <BeginStoryboard Storyboard="{StaticResource ForegroundFadeAccentLightestToText}"/>
                </Trigger.ExitActions>
            </Trigger>
        </Style.Triggers>
    </Style>

    <!-- Textblock with colour change on hover -->
    <Style x:Key="RIIDefaultTextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource DefaultTextBlock}">
        <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
    </Style>

    <Style x:Key="SidebarHeaderTextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource RIIDefaultTextBlock}">
        <Setter Property="HorizontalAlignment" Value="Left"/>
        <Setter Property="FontSize" Value="{DynamicResource FontSizeLarger}"/>
        <Setter Property="FontStyle" Value="Italic"/>
        <Setter Property="FontFamily" Value="{DynamicResource FontRegular}"/>
    </Style>

    <Style x:Key="SidebarTextblock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource TextblockWithColourChange}">
        <Setter Property="FontSize" Value="{DynamicResource FontSizeSmaller}"/>
        <Setter Property="Margin" Value="{DynamicResource CommonItemVerticalMarginSmall}"/>
        <Setter Property="HorizontalAlignment" Value="Center"/>
        <Setter Property="FontFamily" Value="{DynamicResource FontRegular}"/>
    </Style>

    <!-- Button without internal padding -->
    <Style x:Key="UnpaddedButton" TargetType="{x:Type Button}" BasedOn="{StaticResource DefaultButton}">
        <Setter Property="Height" Value="30"/>
        <Setter Property="Padding" Value="0"/>
    </Style>

    <Style x:Key="UnpaddedStretchedButton" TargetType="{x:Type Button}" BasedOn="{StaticResource UnpaddedButton}">
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
    </Style>

    <Style x:Key="UnpaddedStretchedGridButton" TargetType="{x:Type Button}" BasedOn="{StaticResource UnpaddedStretchedButton}">
        <Setter Property="Margin" Value="10,0"/>
    </Style>

    <!-- Buttons to be positioned side by side -->
    <Style x:Key="GridButton" TargetType="{x:Type Button}" BasedOn="{StaticResource DefaultButton}">
        <Setter Property="Margin" Value="10,0"/>
    </Style>

    <!-- Image with High Quality render preset -->
    <Style x:Key="HighQualityImage" TargetType="{x:Type Image}">
        <Setter Property="RenderOptions.BitmapScalingMode" Value="HighQuality"/>
        <Setter Property="RenderOptions.EdgeMode" Value="Aliased"/>
        <Setter Property="RenderOptions.CachingHint" Value="Cache"/>
    </Style>

    <!-- Settings Page Specific -->
    <Style x:Key="StatisticsTextblock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource TextblockWithColourChange}">
        <Setter Property="FontSize" Value="{DynamicResource FontSizeLarge}"/>
        <Setter Property="Margin" Value="{DynamicResource CommonItemVerticalMarginSmall}"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
    </Style>

    <Style x:Key="StatisticsTextvalue" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource TextblockWithColourChange}">
        <Setter Property="FontSize" Value="{DynamicResource FontSizeLarge}"/>
        <Setter Property="Margin" Value="8,0,0,0"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
    </Style>

    <Style x:Key="BuildTextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource TextblockWithColourChange}">
        <Setter Property="FontSize" Value="{DynamicResource FontSizeLargest}"/>
        <Setter Property="Margin" Value="{DynamicResource CommonItemVerticalMarginSmall}"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
    </Style>

    <!-- Custom textbox type featuring a placeholder piece of text -->
    <Style x:Key="TextboxWithPlaceholder" TargetType="{x:Type TextBox}" BasedOn="{StaticResource DefaultTextBox}">

        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <Grid>

                        <!-- Top/Bottom Border -->
                        <Border BorderThickness="{DynamicResource TextboxBorderThickness}" Background="Transparent">
                            <Border.BorderBrush>
                                <VisualBrush>
                                    <VisualBrush.Visual>
                                        <Rectangle Stroke="{TemplateBinding Foreground}"
                                                   StrokeThickness="{DynamicResource TextboxBorderStrokeThickness}"
                                                   Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualWidth}"
                                                   Height="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualHeight}"/>
                                    </VisualBrush.Visual>
                                </VisualBrush>
                            </Border.BorderBrush>
                        </Border>

                        <!-- Text host. -->
                        <ScrollViewer x:Name="PART_ContentHost" 
                                      Focusable="False"
                                      HorizontalAlignment="Center"
                                      VerticalAlignment="Center"
                                      HorizontalScrollBarVisibility="Hidden" 
                                      VerticalScrollBarVisibility="Hidden"
                                      Margin="{DynamicResource TextboxContentMargin}"/>

                        <!-- Block of default text to display if no text in real textbox. -->
                        <TextBlock IsHitTestVisible="False" 
                                   Text="{TemplateBinding Tag}" 
                                   VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                                   HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">
                            <TextBlock.Style>
                                <Style TargetType="{x:Type TextBlock}">
                                    <Setter Property="Foreground" Value="{DynamicResource BorderColorBrush}"/>
                                    <Setter Property="Visibility" Value="Collapsed"/>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding Text, RelativeSource={RelativeSource Mode=TemplatedParent}}" Value="">
                                            <Setter Property="Visibility" Value="Visible"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </TextBlock.Style>
                        </TextBlock>

                    </Grid>
                    <ControlTemplate.Triggers>

                        <!-- Change text when unavailable. -->
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Text" Value="{DynamicResource TextboxDisabledSymbol}"/>
                        </Trigger>

                    </ControlTemplate.Triggers>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Styles not fully inheriting from Control -->
    <Style x:Key="LabelButton" TargetType="{x:Type Button}">

        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Foreground" Value="{DynamicResource BorderColorBrush}"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="HorizontalAlignment" Value="Center"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="FocusVisualStyle" Value="{DynamicResource ReloadedFocusVisual}"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ButtonBase}">

                    <!-- Background and border color -->
                    <Border x:Name="border" 
                            BorderBrush="{TemplateBinding BorderBrush}" 
                            BorderThickness="{TemplateBinding BorderThickness}" 
                            Background="{TemplateBinding Background}" 
                            SnapsToDevicePixels="True">
                        <TextBlock Text="{TemplateBinding Content}"
                                   FontSize="{TemplateBinding FontSize}"
                                   FontStyle="{TemplateBinding FontStyle}"
                                   FontWeight="{TemplateBinding FontWeight}"
                                   FontFamily="{TemplateBinding FontFamily}"
                                   FontStretch="{TemplateBinding FontStretch}"
                                   Foreground="{TemplateBinding Foreground}"
                                   Background="{TemplateBinding Background}"
                                   SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                   VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                   HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                   Margin="{TemplateBinding Padding}"
                                   Focusable="False"  />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>