aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.xaml
blob: 7d997ee08123fae297c3796ec395d2457366ad24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:Tango.Touch.Controls"
                    xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
                    xmlns:keyboard="clr-namespace:Tango.Touch.Keyboard"
                    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
                    >
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="../Resources/Colors.xaml" />
        <ResourceDictionary Source="../Resources/Fonts.xaml" />
        <ResourceDictionary Source="../Styles/TouchButton.xaml" />
        <ResourceDictionary Source="../Styles/TouchIconButton.xaml" />

        <ResourceDictionary>
            <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
            <converters:NullObjectToBooleanConverter x:Key="NullObjectToBooleanConverter" />
        </ResourceDictionary>
    </ResourceDictionary.MergedDictionaries>
    
    <SolidColorBrush x:Key="TransparentBrush" Color="Transparent" />

    <Style TargetType="local:TouchNumericUpDownConrol">
        <Setter Property="Background" Value="{StaticResource TangoNotificationBarMaskBrush}"/>
        <Setter Property="Height" Value="32"/>
        <Setter Property="Focusable" Value="False"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:TouchNumericUpDownConrol">
                    <StackPanel Orientation="Horizontal">
                        <StackPanel.Resources>

                            <Style x:Key="emptyButton" TargetType="RepeatButton" >
                                <Setter Property="Background" Value="Transparent" />
                                <Setter Property="Focusable" Value="False"></Setter>
                                <Setter Property="Foreground" Value="{StaticResource TangoMidAccentBrush}" />
                                <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"/>
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="RepeatButton">
                                            <Border Margin="{TemplateBinding Padding}" Background="{TemplateBinding Background}">
                                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                                            </Border>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                                <Style.Triggers>
                                    <Trigger Property="RepeatButton.IsPressed" Value="True">
                                        <Setter Property="Background" Value="Transparent" />
                                        <Setter Property="Foreground" Value="{StaticResource TangoKeyboardKeyLightBrush}" />
                                    </Trigger>
                                    <EventTrigger RoutedEvent="RepeatButton.TouchDown">
                                        <EventTrigger.Actions>
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TransparentBrush}"></DiscreteObjectKeyFrame>
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TangoKeyboardKeyLightTextBrush}"></DiscreteObjectKeyFrame>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger.Actions>
                                    </EventTrigger>
                                    <EventTrigger RoutedEvent="RepeatButton.TouchLeave">
                                        <EventTrigger.Actions>
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TransparentBrush}"></DiscreteObjectKeyFrame>
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TangoKeyboardKeyDarkTextBrush}"></DiscreteObjectKeyFrame>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger.Actions>
                                    </EventTrigger>
                                </Style.Triggers>
                            </Style>
                        </StackPanel.Resources>
                        <Border Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}"  BorderThickness="0.8" CornerRadius="2" Width="{Binding NumericPartWidth,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}" >

                            <local:TouchNumericTextBox x:Name="Number_PART" Margin="0 4 0 0" FontSize="20"  HorizontalContentAlignment="Center" VerticalAlignment="Center" BorderBrush="{TemplateBinding BorderBrush}" VerticalContentAlignment="Center" UpdateBindingOnlyWhenFocused="True"
                                                Value="{Binding Value,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}"  Minimum="{Binding MinValue,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}" Maximum="{Binding MaxValue,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}" HasDecimalPoint="True" StringFormat="N2"/>

                        </Border>
                        <Border  Margin="10 0 0 0"   BorderBrush="{StaticResource TangoGrayBrush}"  BorderThickness="0.8" Width="80">
                            <StackPanel Orientation="Horizontal">
                                <RepeatButton Focusable="False" Background="Transparent"  Margin="8 0 8 0" Padding="2" Style="{StaticResource emptyButton}" 
                                              Command="{Binding Path=DecrementCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:TouchNumericUpDownConrol}, Mode=TwoWay}">
                                    <local:TouchIcon Focusable="False" Icon="Minus" Width="16" Height="3"/>
                                </RepeatButton>
                                <Rectangle Margin="1 0 1 0" Width="0.8" Fill="{StaticResource TangoGrayBrush}"></Rectangle>
                                <RepeatButton Focusable="False" Background="Transparent"  Margin="8 0 0 0" Padding="4" Style="{StaticResource emptyButton}" 
                                              Command="{Binding Path=IncrementCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:TouchNumericUpDownConrol}, Mode=TwoWay}">
                                    <local:TouchIcon Focusable="False" Icon="Plus" Width="16"/>
                                </RepeatButton>
                            </StackPanel>
                        </Border>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>