aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Touch/Styles/TouchNumericUpDownControl.xaml
blob: 3978e6c4c021c3e04152bc2da9ce2ecd09d814b3 (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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
                    xmlns:controls="clr-namespace:Tango.Touch.Controls"
                    xmlns:local="clr-namespace:Tango.Touch.Styles">

    <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 x:Key="TouchNumericMiddleUpDownControl" TargetType="{x:Type controls:TouchNumericUpDownConrol}">
        <Setter Property="Background" Value="{StaticResource TangoNotificationBarMaskBrush}"/>
        <Setter Property="Height" Value="32"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls: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>
                        <RepeatButton Background="Transparent" Height="40"  Padding="2" Style="{StaticResource emptyButton}"  Command="{Binding Path=DecrementCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:TouchNumericUpDownConrol}, Mode=TwoWay}" VerticalAlignment="Center">
                            <controls:TouchIcon Icon="Minus" Width="22" Height="Auto" VerticalAlignment="Center"/>
                        </RepeatButton>

                        <controls:TouchNumericTextBox x:Name="Number_PART" Margin="50 4 0 0" FontSize="{StaticResource TangoMessageBoxMessageFontSize}"  HorizontalContentAlignment="Center" VerticalAlignment="Center" BorderBrush="{TemplateBinding BorderBrush}" VerticalContentAlignment="Center" UpdateBindingOnlyWhenFocused="True"
                                                Value="{Binding Value,RelativeSource={RelativeSource AncestorType=controls:TouchNumericUpDownConrol}, Mode=TwoWay}"  Minimum="{Binding MinValue,RelativeSource={RelativeSource AncestorType=controls:TouchNumericUpDownConrol}}" Maximum="{Binding MaxValue,RelativeSource={RelativeSource AncestorType=controls:TouchNumericUpDownConrol}, Mode=TwoWay}" HideUnderline="True" HasDecimalPoint="True"/>


                        <RepeatButton Background="Transparent"  Height="40" Margin="50 0 0 0" Padding="2" Style="{StaticResource emptyButton}"  Command="{Binding Path=IncrementCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:TouchNumericUpDownConrol}, Mode=TwoWay}" VerticalAlignment="Center">
                            <controls:TouchIcon Icon="Plus" Width="22" VerticalAlignment="Center"/>
                        </RepeatButton>

                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="TouchNumericBorderUpDownControl" TargetType="{x:Type controls:TouchNumericUpDownConrol}">
        <Setter Property="Background" Value="{StaticResource TangoNotificationBarMaskBrush}"/>
        <Setter Property="Height" Value="40"/>
        <Setter Property="Width" Value="160"/>
        <Setter Property="BorderBrush" Value="{StaticResource TangoDividerBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:TouchNumericUpDownConrol">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0.6" Height="{TemplateBinding Height}">
                    <Grid Width="{TemplateBinding Width}">
                            <Grid.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>
                            </Grid.Resources>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="1*"/>
                                <ColumnDefinition Width="1*"/>
                                <ColumnDefinition Width="1*"/>
                            </Grid.ColumnDefinitions>

                            <RepeatButton Margin="2 0 2 0" Background="Transparent" BorderBrush="Transparent" HorizontalAlignment="Stretch"  HorizontalContentAlignment="Center" Height="{TemplateBinding Height}" VerticalContentAlignment="Stretch"  Padding="2" Style="{StaticResource emptyButton}"  Command="{Binding Path=DecrementCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:TouchNumericUpDownConrol}, Mode=TwoWay}" VerticalAlignment="Stretch" KeyboardNavigation.TabNavigation ="None">
                                <controls:TouchIcon Icon="Minus" Width="22" Height="Auto" VerticalAlignment="Center"/>
                            </RepeatButton>

                            <Rectangle DockPanel.Dock="Right" Width="0.6" Fill="{Binding RelativeSource={RelativeSource AncestorType=controls:TouchNumericUpDownConrol}, Path= BorderBrush}" Height="32" HorizontalAlignment="Right"></Rectangle>
                            
                            <controls:TouchNumericTextBox x:Name="Number_PART" Grid.Column="1" Margin="1 4 1 0" FontSize="{StaticResource TangoMessageBoxMessageFontSize}" HorizontalAlignment="Stretch"  HorizontalContentAlignment="Center" VerticalAlignment="Center" BorderBrush="Transparent" VerticalContentAlignment="Center" UpdateBindingOnlyWhenFocused="True"
                                                Value="{Binding Value,RelativeSource={RelativeSource AncestorType=controls:TouchNumericUpDownConrol}, Mode=TwoWay}"  Minimum="{Binding MinValue,RelativeSource={RelativeSource AncestorType=controls:TouchNumericUpDownConrol}}" Maximum="{Binding MaxValue,RelativeSource={RelativeSource AncestorType=controls:TouchNumericUpDownConrol}, Mode=TwoWay}" HideUnderline="True" HasDecimalPoint="True" KeyboardNavigation.TabNavigation="Continue"/>

                            <Rectangle Grid.Column="1" Width="0.6" Fill="{Binding RelativeSource={RelativeSource AncestorType=controls:TouchNumericUpDownConrol}, Path= BorderBrush}" Height="40" HorizontalAlignment="Right"></Rectangle>

                            <RepeatButton Grid.Column="2" Background="Transparent" BorderBrush="Transparent"   Margin="0 0 0 0" Padding="2" Style="{StaticResource emptyButton}"  Command="{Binding Path=IncrementCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:TouchNumericUpDownConrol}, Mode=TwoWay}" VerticalAlignment="Center" HorizontalAlignment="Stretch"  HorizontalContentAlignment="Center" KeyboardNavigation.TabNavigation ="None">
                                <controls:TouchIcon Icon="Plus" Width="22" VerticalAlignment="Center"/>
                            </RepeatButton>

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

</ResourceDictionary>