<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:CustomControls" 
    xmlns:System="clr-namespace:System;assembly=mscorlib">

    <!-- ImageButton Colors -->
    <Color x:Key="ButtonInnerBorderColor1">#FFADADAD</Color>
    <Color x:Key="ButtonInnerBorderColor2">#FF606060</Color>

    <Color x:Key="HoverBackgroundColor">#FFE0E0E0</Color>
    <Color x:Key="PressedBackgroundColor">#FF000000</Color>
    <Color x:Key="DisabledBackgroundColor">#FF898989</Color>

    <!-- ImageButton Brushes -->
    <LinearGradientBrush x:Key="ButtonInnerBorderBrush" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="{StaticResource ButtonInnerBorderColor1}"/>
        <GradientStop Color="{StaticResource ButtonInnerBorderColor2}" Offset="1"/>
    </LinearGradientBrush>
    <SolidColorBrush x:Key="HoverBackgroundBrush" Color="{StaticResource HoverBackgroundColor}"/>
    <SolidColorBrush x:Key="PressedBackgroundBrush" Color="{StaticResource PressedBackgroundColor}"/>
    <SolidColorBrush x:Key="DisabledBackgroundBrush" Color="{StaticResource DisabledBackgroundColor}"/>
    <LinearGradientBrush x:Key="FocusedBrush" EndPoint="0.5,0.971" StartPoint="0.5,0.042">
        <GradientStop Color="#4CFFFFFF" Offset="0" />
        <GradientStop Color="#26FFFFFF" Offset="1" />
        <GradientStop Color="#26FFFFFF" Offset="0.467" />
        <GradientStop Color="#00FFFFFF" Offset="0.475" />
        <GradientStop Color="#00FFFFFF" Offset="0.856" />
    </LinearGradientBrush>

    <!-- ImageButton Style -->
    <Style TargetType="local:ImageButton">
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ImageButton">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="00:00:00.1" To="MouseOver" />
                                    <VisualTransition GeneratedDuration="00:00:00.1" To="Pressed" />
                                    <VisualTransition From="Normal" GeneratedDuration="00:00:00.3000000" To="MouseOver" />
                                    <VisualTransition From="MouseOver" GeneratedDuration="00:00:00.5000000" To="Normal" />
                                    <VisualTransition From="MouseOver" GeneratedDuration="00:00:00.1000000" To="Pressed" />
                                    <VisualTransition From="Pressed" GeneratedDuration="00:00:00.3000000" To="MouseOver" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="HoverBackground" Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value=".2" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="PressedBackground" Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value=".2" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledOverlay" Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="0" Value=".6" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.5" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Border x:Name="Background" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
                            <Border Background="{TemplateBinding Background}" BorderBrush="{StaticResource ButtonInnerBorderBrush}" BorderThickness="1" CornerRadius="2"/>
                        </Border>
                        <Border x:Name="HoverBackground" Background="{StaticResource HoverBackgroundBrush}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3" Opacity="0"/>
                        <Border x:Name="PressedBackground" Background="{StaticResource PressedBackgroundBrush}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3" Opacity="0"/>
                        <StackPanel Orientation="Horizontal" Margin="10,2">
                            <Image x:Name="ButtonImage" Source="{TemplateBinding ImageSource}" Width="16" Height="16" Margin="0,2,0,0"/>
                            <Rectangle Width="4"/>
                            <ContentPresenter x:Name="contentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" />
                        </StackPanel>
                        <Border x:Name="DisabledOverlay" Background="{StaticResource DisabledBackgroundBrush}" CornerRadius="4" Opacity="0" IsHitTestVisible="false"/>
                        <Border x:Name="FocusVisualElement" BorderBrush="{StaticResource FocusedBrush}" BorderThickness="1" CornerRadius="4" Margin="1" Visibility="Collapsed" IsHitTestVisible="false" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <!-- NavigationButton Colors -->
    <Color x:Key="NavigationButtonForegroundColor">#FFF8F8F8</Color>
    <Color x:Key="NavigationButtonBackgroundColor">#FF000000</Color>
    <Color x:Key="NavigationButtonBorderColor">#33FFFFFF</Color>

    <!-- NavigationButton Brushes -->
    <SolidColorBrush x:Key="NavigationButtonForegroundBrush" Color="{StaticResource NavigationButtonForegroundColor}" />
    <SolidColorBrush x:Key="NavigationButtonBackgroundBrush" Color="{StaticResource NavigationButtonBackgroundColor}" />
    <SolidColorBrush x:Key="NavigationButtonBorderBrush" Color="{StaticResource NavigationButtonBorderColor}" />
    <LinearGradientBrush x:Key="NavigationButtonGlowBrush" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#B2FFD200" Offset="1"/>
        <GradientStop Color="#00FFD200"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="NavigationButtonShineBrush" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#CCFFFFFF"/>
        <GradientStop Color="#19FFFFFF" Offset="1"/>
    </LinearGradientBrush>

    <!-- Drop Shadow Styles -->
    <System:Double x:Key="NavigationButtonTextDropShadowOpacity">0.5</System:Double>
    <System:Double x:Key="NavigationButtonTextDropShadowDepth">2</System:Double>

    <!-- NavigationButton Component Styles -->
    <Style x:Key="NavigationButtonContainerStyle" TargetType="Border">
        <Setter Property="Width" Value="100" />
        <Setter Property="Height" Value="100" />
        <Setter Property="CornerRadius" Value="25" />
    </Style>
    <Style x:Key="NavigationButtonBorderStyle" TargetType="Border">
        <Setter Property="BorderBrush" Value="{StaticResource NavigationButtonBorderBrush}" />
        <Setter Property="BorderThickness" Value="2" />
        <Setter Property="CornerRadius" Value="25" />
    </Style>
    <Style x:Key="NavigationButtonImageStyle" TargetType="Image">
        <Setter Property="Width" Value="32" />
        <Setter Property="Height" Value="32" />
    </Style>
    <Style x:Key="NavigationButtonHoverBackgroundStyle" TargetType="Border">
        <Setter Property="Background" Value="{StaticResource NavigationButtonGlowBrush}" />
        <Setter Property="CornerRadius" Value="5,5,25,25" />
        <Setter Property="Height" Value="30" />
        <Setter Property="VerticalAlignment" Value="Bottom" />
        <Setter Property="Opacity" Value="0" />
    </Style>
    <Style x:Key="NavigationButtonShineStyle" TargetType="Border">
        <Setter Property="Background" Value="{StaticResource NavigationButtonShineBrush}" />
        <Setter Property="VerticalAlignment" Value="Top" />
        <Setter Property="Height" Value="50" />
        <Setter Property="CornerRadius" Value="25,25,10,10" />
    </Style>
    <Style x:Key="NavigationButtonTextStyle" TargetType="TextBlock">
        <Setter Property="FontWeight" Value="Bold" />
        <Setter Property="HorizontalAlignment" Value="Center" />
    </Style>
    <LinearGradientBrush x:Key="NavigationButtonOpacityMaskBrush" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Offset="0.684"/>
        <GradientStop Color="#4CFFFFFF" Offset="1"/>
    </LinearGradientBrush>

    <!-- NavigationButton Style -->
    <Style TargetType="local:NavigationButton">
        <Setter Property="Foreground" Value="{StaticResource NavigationButtonForegroundBrush}" />
        <Setter Property="Background" Value="{StaticResource NavigationButtonBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource NavigationButtonBorderBrush}" />
        <Setter Property="BorderThickness" Value="2" />
        <Setter Property="Opacity" Value="0" />
        <Setter Property="HorizontalAlignment" Value="Center" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:NavigationButton">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="00:00:00.1" To="MouseOver" />
                                    <VisualTransition GeneratedDuration="00:00:00.1" To="Pressed" />
                                    <VisualTransition From="Normal" GeneratedDuration="00:00:00.3000000" To="MouseOver" />
                                    <VisualTransition From="MouseOver" GeneratedDuration="00:00:00.5000000" To="Normal" />
                                    <VisualTransition From="MouseOver" GeneratedDuration="00:00:00.1000000" To="Pressed" />
                                    <VisualTransition From="Pressed" GeneratedDuration="00:00:00.3000000" To="MouseOver" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.001" Storyboard.TargetName="MouseOverGlow" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1" KeySpline="0,1,1,1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.001" Storyboard.TargetName="MouseOverGlow2" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1" KeySpline="0,1,1,1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.001" Storyboard.TargetName="MouseOverGlow" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.001" Storyboard.TargetName="MouseOverGlow2" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled"/>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused"/>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <StackPanel Opacity="{TemplateBinding Opacity}">
                            <Grid>
                                <Border Background="{TemplateBinding Background}" Style="{StaticResource NavigationButtonContainerStyle}">
                                    <StackPanel VerticalAlignment="{TemplateBinding VerticalAlignment}">
                                        <Image Source="{TemplateBinding ImageSource}" Style="{StaticResource NavigationButtonImageStyle}"/>
                                        <Rectangle Height="5"/>
                                        <TextBlock Text="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" Style="{StaticResource NavigationButtonTextStyle}">
                                            <TextBlock.Effect>
        					                    <DropShadowEffect Opacity="{Binding NavigationButtonTextDropShadowOpacity}" ShadowDepth="{Binding NavigationButtonTextDropShadowDepth}"/>
        				                    </TextBlock.Effect>
                                        </TextBlock>
                                    </StackPanel>
                                </Border>
                                <Border BorderBrush="{StaticResource NavigationButtonBorderBrush}" BorderThickness="2" CornerRadius="25"/>
                                <Border x:Name="MouseOverGlow" Style="{StaticResource NavigationButtonHoverBackgroundStyle}"/>
                                <Border x:Name="Shine" Style="{StaticResource NavigationButtonShineStyle}"/>
                            </Grid>
                            <Rectangle Height="3"/>
                            <Grid OpacityMask="{StaticResource NavigationButtonOpacityMaskBrush}" RenderTransformOrigin="0.5,0.5">
                                <Grid.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="-1"/>
                                        <SkewTransform AngleX="0" AngleY="0"/>
                                        <RotateTransform Angle="-180"/>
                                        <TranslateTransform/>
                                    </TransformGroup>
                                </Grid.RenderTransform>
                                <Border Background="{TemplateBinding Background}" Style="{StaticResource NavigationButtonContainerStyle}">
                                    <StackPanel VerticalAlignment="{TemplateBinding VerticalAlignment}">
                                        <Image Source="{TemplateBinding ImageSource}" Style="{StaticResource NavigationButtonImageStyle}"/>
                                        <Rectangle Height="5"/>
                                        <TextBlock Text="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" Style="{StaticResource NavigationButtonTextStyle}">
                                        <TextBlock.Effect>
    					                    <DropShadowEffect Opacity="{Binding NavigationButtonTextDropShadowOpacity}" ShadowDepth="{Binding NavigationButtonTextDropShadowDepth}"/>
    				                    </TextBlock.Effect>
                                        </TextBlock>
                                    </StackPanel>
                                </Border>
                                <Border BorderBrush="{StaticResource NavigationButtonBorderBrush}" BorderThickness="2" CornerRadius="25"/>
                                <Border x:Name="MouseOverGlow2" Style="{StaticResource NavigationButtonHoverBackgroundStyle}"/>
                                <Border x:Name="Shine2" Style="{StaticResource NavigationButtonShineStyle}"/>
                            </Grid>
                        </StackPanel>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- ClippingBorder style -->
    <Style TargetType="local:ClippingBorder">
        <Setter Property="ClipContent" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ClippingBorder">
                    <Border Background="{TemplateBinding Background}" CornerRadius="{TemplateBinding CornerRadius}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" x:Name="PART_Border">
                        <Grid>
                            <ContentControl x:Name="PART_TopLeftContentControl" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
                                <ContentControl.Clip>
                                    <RectangleGeometry x:Name="PART_TopLeftClip" />
                                </ContentControl.Clip>
                                <ContentControl x:Name="PART_TopRightContentControl" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" >
                                    <ContentControl.Clip>
                                        <RectangleGeometry x:Name="PART_TopRightClip" />
                                    </ContentControl.Clip>
                                    <ContentControl x:Name="PART_BottomRightContentControl" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" >
                                        <ContentControl.Clip>
                                            <RectangleGeometry x:Name="PART_BottomRightClip" />
                                        </ContentControl.Clip>
                                        <ContentControl x:Name="PART_BottomLeftContentControl" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" >
                                            <ContentControl.Clip>
                                                <RectangleGeometry x:Name="PART_BottomLeftClip" />
                                            </ContentControl.Clip>
                                            <ContentPresenter Margin="{TemplateBinding Padding}" />
                                        </ContentControl>
                                    </ContentControl>
                                </ContentControl>
                            </ContentControl>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- FormLabel Style -->
    <Style TargetType="local:FormLabel">
        <Setter Property="IsTabStop" Value="false" />
        <Setter Property="Foreground" Value="#000000" />
        <Setter Property="TextWrapping" Value="NoWrap" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:FormLabel">
                    <Border
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        Padding="{TemplateBinding Padding}">
                        <TextBlock
                          Text="{TemplateBinding Text}"
                          FontFamily="{TemplateBinding FontFamily}" 
                          FontSize="{TemplateBinding FontSize}"
                          FontStretch="{TemplateBinding FontStretch}"
                          FontStyle="{TemplateBinding FontStyle}" 
                          FontWeight="{TemplateBinding FontWeight}"
                          Foreground="{TemplateBinding Foreground}"
                          TextAlignment="{TemplateBinding TextAlignment}"
                          TextDecorations="{TemplateBinding TextDecorations}" 
                          TextWrapping="{TemplateBinding TextWrapping}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
