aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml
blob: 5440166f81c268ed5eb4a21b687b20808a82a231 (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
<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:keyboard="clr-namespace:Tango.Touch.Keyboard"
                    xmlns:local="clr-namespace:Tango.Touch.Controls">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="../Resources/Colors.xaml" />
        <ResourceDictionary Source="../Resources/Fonts.xaml" />
        <ResourceDictionary Source="../Styles/TouchButton.xaml" />

        <ResourceDictionary>
            <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
            <converters:NullObjectToBooleanConverter x:Key="NullObjectToBooleanConverter" />
        </ResourceDictionary>
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="TangoMessageBoxButton" TargetType="{x:Type local:TouchButton}" BasedOn="{StaticResource TangoFlatButton}">
        <Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
        <Setter Property="Foreground" Value="{StaticResource TangoDarkForegroundBrush}"></Setter>
        <Setter Property="FontSize" Value="{StaticResource TangoButtonFontSize}"></Setter>
        <Setter Property="BorderBrush" Value="{StaticResource TangoDividerBrush}"></Setter>
        <Setter Property="BorderThickness" Value="1 0 0 0"></Setter>
    </Style>

    <Style x:Key="TangoMessageBoxTitle" TargetType="TextBlock">
        <Setter Property="FontSize" Value="{StaticResource TangoMessageBoxTitleFontSize}"></Setter>
        <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter>
    </Style>

    <Style TargetType="local:TouchPanel">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:TouchPanel">
                    <Border Background="{TemplateBinding Background}">
                        <Grid>
                            <keyboard:KeyboardView>
                                <Grid>

                                    <!--Notification Bar-->
                                    <local:TouchNotificationBar NotificationTemplate="{TemplateBinding NotificationTemplate}" HasNotifications="{TemplateBinding HasNotifications}" Notifications="{TemplateBinding Notifications}" ItemExpandedPropertyPath="{TemplateBinding ItemExpandedPropertyPath}">
                                        <Grid>
                                            <!--Content-->
                                            <ContentPresenter Content="{TemplateBinding Content}" />
                                        </Grid>
                                    </local:TouchNotificationBar>

                                    <!--Combo Box PopUp-->
                                    <Grid Background="#9E000000" x:Name="PART_combobox_grid">
                                        <Grid.Style>
                                            <Style TargetType="Grid">
                                                <Setter Property="Opacity" Value="0"></Setter>
                                                <Setter Property="Visibility" Value="Hidden"></Setter>
                                                <Style.Triggers>
                                                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource TemplatedParent},Path=CurrentComboBox,Converter={StaticResource NullObjectToBooleanConverter}}" Value="True">
                                                        <Setter Property="Visibility" Value="Visible"></Setter>
                                                        <DataTrigger.EnterActions>
                                                            <BeginStoryboard>
                                                                <Storyboard>
                                                                    <DoubleAnimation To="1" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" />
                                                                </Storyboard>
                                                            </BeginStoryboard>
                                                        </DataTrigger.EnterActions>
                                                    </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </Grid.Style>

                                        <Grid DataContext="{Binding RelativeSource={RelativeSource TemplatedParent},Path=CurrentComboBox}" VerticalAlignment="Center" HorizontalAlignment="Center">
                                            <Border Background="{StaticResource TangoPrimaryBackgroundBrush}" CornerRadius="5" Margin="10" Padding="{Binding Padding}">
                                                <Border.Effect>
                                                    <DropShadowEffect BlurRadius="10" />
                                                </Border.Effect>

                                                <Grid ClipToBounds="True">
                                                    <DockPanel>
                                                        <Border DockPanel.Dock="Top" BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 0 0 1" Padding="10 10 10 15">
                                                            <TextBlock DockPanel.Dock="Top" Text="{Binding Title}" FontSize="{StaticResource TangoTitleFontSize}"></TextBlock>
                                                        </Border>
                                                        <local:TouchListBox x:Name="PART_ComboBoxList" Margin="0 10 0 0" Width="{Binding MinPopupWidth}" Height="{Binding MinPopupHeight}" ItemSelectedCommand="{Binding RelativeSource={RelativeSource AncestorType=local:TouchPanel},Path=ComboBoxPickedCommand}" ItemsSource="{Binding ItemsSource}" SelectionMode="None" ItemTemplate="{Binding ItemTemplate}" VerticalAlignment="Top">

                                                        </local:TouchListBox>
                                                    </DockPanel>
                                                </Grid>
                                            </Border>
                                        </Grid>
                                    </Grid>

                                    <!--Dialogs-->
                                    <Grid Background="#9E000000">
                                        <Grid.Style>
                                            <Style TargetType="Grid">
                                                <Setter Property="Opacity" Value="0"></Setter>
                                                <Setter Property="Visibility" Value="Hidden"></Setter>
                                                <Style.Triggers>
                                                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource TemplatedParent},Path=HasDialog}" Value="True">
                                                        <Setter Property="Visibility" Value="Visible"></Setter>
                                                        <DataTrigger.EnterActions>
                                                            <BeginStoryboard>
                                                                <Storyboard>
                                                                    <DoubleAnimation To="1" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" />
                                                                </Storyboard>
                                                            </BeginStoryboard>
                                                        </DataTrigger.EnterActions>
                                                    </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </Grid.Style>

                                        <Border Background="{StaticResource TangoPrimaryBackgroundBrush}" CornerRadius="5" Padding="10" HorizontalAlignment="Center" VerticalAlignment="Center">
                                            <Border.Effect>
                                                <DropShadowEffect BlurRadius="10" />
                                            </Border.Effect>

                                            <ContentPresenter Content="{Binding RelativeSource={RelativeSource TemplatedParent},Path=CurrentDialog}" />
                                        </Border>
                                    </Grid>

                                    <!--Messages-->
                                    <Grid Background="#9E000000">
                                        <Grid.Style>
                                            <Style TargetType="Grid">
                                                <Setter Property="Opacity" Value="0"></Setter>
                                                <Setter Property="Visibility" Value="Hidden"></Setter>
                                                <Style.Triggers>
                                                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource TemplatedParent},Path=HasMessageBox}" Value="True">
                                                        <Setter Property="Visibility" Value="Visible"></Setter>
                                                        <DataTrigger.EnterActions>
                                                            <BeginStoryboard>
                                                                <Storyboard>
                                                                    <DoubleAnimation To="1" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" />
                                                                </Storyboard>
                                                            </BeginStoryboard>
                                                        </DataTrigger.EnterActions>
                                                    </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </Grid.Style>

                                        <Grid DataContext="{Binding RelativeSource={RelativeSource TemplatedParent},Path=CurrentMessageBox}" Height="400" Margin="20">
                                            <Border Background="{StaticResource TangoPrimaryBackgroundBrush}" CornerRadius="5" Margin="10">
                                                <Border.Effect>
                                                    <DropShadowEffect BlurRadius="10" />
                                                </Border.Effect>

                                                <Grid ClipToBounds="True">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="100"/>
                                                        <ColumnDefinition Width="75*"/>
                                                    </Grid.ColumnDefinitions>
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="100" />
                                                        <RowDefinition Height="1*" />
                                                        <RowDefinition Height="70"/>
                                                    </Grid.RowDefinitions>

                                                    <local:TouchIcon Grid.Row="0" Icon="{Binding Icon}" Margin="20" Foreground="{Binding Brush}" />
                                                    <TextBlock Grid.Column="1" Text="{Binding Title,TargetNullValue=Confirm}" Foreground="{Binding Brush,TargetNullValue={StaticResource TangoPrimaryAccentBrush}}" VerticalAlignment="Center" Margin="10" Style="{StaticResource TangoMessageBoxTitle}"></TextBlock>

                                                    <Rectangle Stroke="{Binding Brush}" VerticalAlignment="Bottom" Grid.ColumnSpan="2" StrokeThickness="3" />

                                                    <TextBlock Grid.Row="1" FontSize="{StaticResource TangoMessageBoxMessageFontSize}" Text="{Binding Message}" VerticalAlignment="Top" Grid.Column="1" TextWrapping="Wrap" Margin="10 20 10 10"></TextBlock>

                                                    <Rectangle Stroke="{StaticResource TangoDividerBrush}" VerticalAlignment="Bottom" Grid.Row="1" Grid.ColumnSpan="2" StrokeThickness="1"/>

                                                    <StackPanel Grid.Column="1" Grid.Row="2" HorizontalAlignment="Right" Orientation="Horizontal">
                                                        <local:TouchButton x:Name="btnCancel" Width="180" Margin="2 0" Style="{StaticResource TangoMessageBoxButton}" Command="{Binding CloseCommand}" Visibility="{Binding HasCancel,Converter={StaticResource BooleanToVisibilityConverter}}">CANCEL</local:TouchButton>
                                                        <local:TouchButton x:Name="btnOK" Width="180" Margin="2 0" Style="{StaticResource TangoMessageBoxButton}" Command="{Binding OKCommand}">OK</local:TouchButton>
                                                    </StackPanel>
                                                </Grid>
                                            </Border>
                                        </Grid>
                                    </Grid>
                                </Grid>
                            </keyboard:KeyboardView>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


</ResourceDictionary>