aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Touch/Styles/TouchNumericUpDownControl.xaml
blob: 6b3ef44845735211c9c11fdd07d4210062b83da5 (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
<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="23"  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="16" Height="3" VerticalAlignment="Center"/>
                        </RepeatButton>

                        <controls:TouchNumericTextBox x:Name="Number_PART" Margin="16 4 0 0" FontSize="20"  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}"/>


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

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

</ResourceDictionary>