<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:c1="using:C1.Xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="ms-appx:///C1.UWP/themes/Common.xaml"/>
        <ResourceDictionary Source="ms-appx:///C1.UWP/themes/C1Button.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <!--****************** C1NumericBox ******************-->

    <Style TargetType="c1:C1NumericBox">
        <Setter Property="Foreground" Value="{ThemeResource TextBoxForegroundThemeBrush}"/>
        <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
        <Setter Property="Background" Value="{ThemeResource TextBoxBackgroundThemeBrush}"/>
        <Setter Property="BorderBrush" Value="{ThemeResource TextBoxBorderThemeBrush}"/>
        <Setter Property="BorderThickness" Value="{ThemeResource TextControlBorderThemeThickness}"/>
        <Setter Property="ButtonBackground" Value="{ThemeResource ButtonBackgroundThemeBrush}"/>
        <Setter Property="ButtonForeground" Value="{ThemeResource ButtonForegroundThemeBrush}"/>
        <Setter Property="MouseOverBrush" Value="{ThemeResource ButtonPointerOverBackgroundThemeBrush}"/>
        <Setter Property="PressedBrush" Value="{ThemeResource ButtonPressedBackgroundThemeBrush}" />
        <Setter Property="FocusBrush" Value="{ThemeResource TextBoxBorderThemeBrush}"/>
        <Setter Property="Padding" Value="{ThemeResource TextControlThemePadding}"/>
        <Setter Property="MinWidth" Value="{ThemeResource TextControlThemeMinWidth}"/>
        <Setter Property="MinHeight" Value="{ThemeResource TextControlThemeMinHeight}"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="TextAlignment" Value="Right"/>
        <Setter Property="Interval" Value="33" />
        <Setter Property="Delay" Value="500" />
        <Setter Property="CornerRadius" Value="{StaticResource GeneralCornerRadius}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="c1:C1NumericBox" >
                    <Grid x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="BackgroundElement">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxDisabledBackgroundThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="BorderElement">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxDisabledBorderThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="Text">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxDisabledForegroundThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="{StaticResource TextControlPointerOverBackgroundThemeOpacity}" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BackgroundElement"/>
                                        <DoubleAnimation Duration="0" To="{StaticResource TextControlPointerOverBorderThemeOpacity}" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BorderElement"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Normal"/>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="FocusedBorderElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0"
                                                         To="1" />
                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BackgroundElement"/>
                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BorderElement"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused"/>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ButtonsVisibilityStates">
                                <VisualState x:Name="HideButtons">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="Increase" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="Decrease" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="ShowButtons">
                                    <Storyboard/>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid"/>
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationDecorator" Storyboard.TargetProperty="ValidationState">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <c1:ValidationState>InvalidUnfocused</c1:ValidationState>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused" >
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationDecorator" Storyboard.TargetProperty="ValidationState">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <c1:ValidationState>InvalidFocused</c1:ValidationState>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition x:Name="ButtonsColumn" Width="Auto" />
                            </Grid.ColumnDefinitions> 
                            <Border x:Name="BackgroundElement" Background="{TemplateBinding Background}" Margin="{TemplateBinding BorderThickness}" Opacity="{StaticResource TextControlBackgroundThemeOpacity}"/>
                            <Border x:Name="BorderElement" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Opacity="{StaticResource TextControlBorderThemeOpacity}"/>
                            <c1:C1TextBoxBase x:Name="Text"
								Foreground="{TemplateBinding Foreground}"
								Background="Transparent" 
                                MouseOverBrush="Transparent"
                                BorderBrush="Transparent"
                                BorderThickness="{TemplateBinding BorderThickness}"
								HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
								VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                c1:ClearStyleExtensions.CornerRadius="{TemplateBinding CornerRadius}"
								TextAlignment="{TemplateBinding TextAlignment}"
								Watermark="{TemplateBinding Watermark}"
								FocusCuesVisibility="Collapsed" 
								DisabledCuesVisibility="Collapsed"
								Padding="{TemplateBinding Padding}" 
                                InputScope="{TemplateBinding InputScope}"
                                              MinWidth="{TemplateBinding MinWidth}"/>
                            <RepeatButton x:Name="Decrease" Grid.Column="1"
													Delay="{TemplateBinding Delay}" 
													Interval="{TemplateBinding Interval}" 
													IsTabStop="True" MinWidth="40" 
                                                    MinHeight="{TemplateBinding MinHeight}"
                                                    Margin="3 -3 0 -3"
                                                    c1:ClearStyleExtensions.CornerRadius="{TemplateBinding CornerRadius}"
                                                    Background="{TemplateBinding ButtonBackground}"
                                                    Foreground="{TemplateBinding ButtonForeground}"
                                                    c1:ClearStyleExtensions.MouseOverBrush="{TemplateBinding MouseOverBrush}"
                                                    c1:ClearStyleExtensions.PressedBrush="{TemplateBinding PressedBrush}"
                                                    BorderBrush="{TemplateBinding BorderBrush}"
                                                    BorderThickness="{TemplateBinding BorderThickness}"
                                                    VerticalAlignment="Stretch"
                                                    VerticalContentAlignment="Center"
                                                    Style="{StaticResource ClearStyleButtonStyle}"
                                                    FontSize="24"
                                                    Padding="16 -7 16 0"
                                                    Content="-">
                            </RepeatButton>
                            <RepeatButton x:Name="Increase" Grid.Column="2"
													Delay="{TemplateBinding Delay}" 
													Interval="{TemplateBinding Interval}" 
													IsTabStop="True" MinWidth="40" MinHeight="{TemplateBinding MinHeight}"
                                                    Margin="0 -3 -3 -3" 
                                                    c1:ClearStyleExtensions.CornerRadius="{TemplateBinding CornerRadius}"
                                                    Background="{TemplateBinding ButtonBackground}"
                                                    Foreground="{TemplateBinding ButtonForeground}"
                                                    c1:ClearStyleExtensions.MouseOverBrush="{TemplateBinding MouseOverBrush}"
                                                    c1:ClearStyleExtensions.PressedBrush="{TemplateBinding PressedBrush}"
                                                    BorderBrush="{TemplateBinding BorderBrush}"
                                                    BorderThickness="{TemplateBinding BorderThickness}"
                                                    VerticalAlignment="Stretch"
                                                    VerticalContentAlignment="Center"
                                                    Style="{StaticResource ClearStyleButtonStyle}"
                                                    FontSize="24"
                                                    Padding="12 -7 13 0"
                                                    Content="+">
                                <!--<Path Data="M5,0 L7,0 L7,5 L12,5 L12,7 L7,7 L7,12 L5,12 L5,7 L0,7 L0,5 L5,5 z" Stretch="Fill" Fill="{TemplateBinding ButtonForeground}" Height="12" Width="12"/>-->
                            </RepeatButton>
                            <Border x:Name="FocusedBorderElement" Opacity="0"
                                BorderBrush="{TemplateBinding FocusBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}"
                                    MinWidth="{TemplateBinding MinWidth}"/>
                        </Grid>
                        <c1:C1ValidationDecorator x:Name="ValidationDecorator" 
                                                  Target="{Binding RelativeSource={RelativeSource TemplatedParent}}" 
                                                  Style="{TemplateBinding ValidationDecoratorStyle}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
