aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.SharedUI/Keyboard/TouchKeyboard.xaml
blob: 1ee475d6d37096cec520244edcc80f39c5bef422 (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
<UserControl x:Class="Tango.SharedUI.Keyboard.TouchKeyboard"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:Tango.SharedUI.Keyboard"
			 xmlns:fa="http://schemas.fontawesome.io/icons/"
             mc:Ignorable="d" 
             d:DesignHeight="220" d:DesignWidth="400" d:DataContext="{d:DesignInstance Type=local:TouchKeyboard, IsDesignTimeCreatable=True}" DataContext="{Binding RelativeSource={RelativeSource  Self}}">

	<UserControl.Resources>


		<Style x:Key="keyboardButton" TargetType="Button">
			<Setter Property="Background" Value="Transparent" />
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="Button">
						<Border Background="{TemplateBinding Background}" Margin="4" CornerRadius="5">
							<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<Style x:Key="numberButton" TargetType="Button" BasedOn="{StaticResource keyboardButton}">
			<Setter Property="Background" Value="Gray"></Setter>
			<Setter Property="Foreground" Value="White"></Setter>
			<Setter Property="MinWidth" Value="{Binding RelativeSource={RelativeSource AncestorType=local:TouchKeyboard},Path=KeySize.Width}"></Setter>
			<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource AncestorType=local:TouchKeyboard},Path=KeySize.Height}"></Setter>
		</Style>

		<Style x:Key="specialButton" TargetType="Button" BasedOn="{StaticResource keyboardButton}">
			<Setter Property="Background" Value="Gray"></Setter>
			<Setter Property="Foreground" Value="White"></Setter>
			<Setter Property="MinWidth" Value="{Binding RelativeSource={RelativeSource AncestorType=local:TouchKeyboard},Path=KeySize.Width}"></Setter>
			<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource AncestorType=local:TouchKeyboard},Path=KeySize.Height}"></Setter>
		</Style>

		<Style x:Key="normalButton" TargetType="Button" BasedOn="{StaticResource keyboardButton}">
			<Setter Property="Background" Value="Gainsboro"></Setter>
			<Setter Property="Foreground" Value="#202020"></Setter>
			<Setter Property="MinWidth" Value="{Binding RelativeSource={RelativeSource AncestorType=local:TouchKeyboard},Path=KeySize.Width}"></Setter>
			<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource AncestorType=local:TouchKeyboard},Path=KeySize.Height}"></Setter>
		</Style>
	</UserControl.Resources>

	<Grid>
		<Grid Background="Silver">
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto"/>
				<RowDefinition Height="Auto"/>
				<RowDefinition Height="45"/>
			</Grid.RowDefinitions>

			<ItemsControl ItemsSource="{Binding NumbersLineDefinition.KeyDefinitions}">
				<ItemsControl.ItemsPanel>
					<ItemsPanelTemplate>
						<UniformGrid Columns="{Binding NumbersLineDefinition.KeyDefinitions.Count}"></UniformGrid>
					</ItemsPanelTemplate>
				</ItemsControl.ItemsPanel>
				<ItemsControl.ItemTemplate>
					<DataTemplate>
						<Button Content="{Binding StandardText}" Style="{StaticResource numberButton}"></Button>
					</DataTemplate>
				</ItemsControl.ItemTemplate>
			</ItemsControl>

			<Grid Grid.Row="1">
				<ItemsControl ItemsSource="{Binding CurrentKeyboardDefinition.KeysLinesDefinitions}">
					<ItemsControl.ItemTemplate>
						<DataTemplate>
							<Grid>
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="1*" />
									<ColumnDefinition Width="Auto" />
									<ColumnDefinition Width="1*" />
								</Grid.ColumnDefinitions>
								
								<ItemsControl ItemsSource="{Binding SpecialLeftKeyDefinitions}">
									<ItemsControl.ItemsPanel>
										<ItemsPanelTemplate>
											<UniformGrid Rows="1" HorizontalAlignment="Stretch"></UniformGrid>
										</ItemsPanelTemplate>
									</ItemsControl.ItemsPanel>
									<ItemsControl.ItemTemplate>
										<DataTemplate>
											<Button Style="{StaticResource specialButton}">
												<Viewbox Stretch="Uniform" Margin="10">
													<Path Data="{Binding VectorMarkup}" Width="10" Height="10" Stretch="Uniform" Fill="White"></Path>
												</Viewbox>
											</Button>
										</DataTemplate>
									</ItemsControl.ItemTemplate>
								</ItemsControl>

								<ItemsControl ItemsSource="{Binding SpecialRightKeyDefinitions}" Grid.Column="2">
									<ItemsControl.ItemsPanel>
										<ItemsPanelTemplate>
											<UniformGrid Rows="1" HorizontalAlignment="Stretch"></UniformGrid>
										</ItemsPanelTemplate>
									</ItemsControl.ItemsPanel>
									<ItemsControl.ItemTemplate>
										<DataTemplate>
											<Button Style="{StaticResource specialButton}">
												<Viewbox Stretch="Uniform" Margin="10">
													<Path Data="{Binding VectorMarkup}" Width="10" Height="10" Stretch="Uniform" Fill="White"></Path>
												</Viewbox>
											</Button>
										</DataTemplate>
									</ItemsControl.ItemTemplate>
								</ItemsControl>

								<ItemsControl ItemsSource="{Binding KeyDefinitions}" Grid.Column="1">
									<ItemsControl.ItemsPanel>
										<ItemsPanelTemplate>
											<UniformGrid Rows="1" HorizontalAlignment="Center"></UniformGrid>
										</ItemsPanelTemplate>
									</ItemsControl.ItemsPanel>
									<ItemsControl.ItemTemplate>
										<DataTemplate>
											<Button Style="{StaticResource normalButton}" Content="{Binding StandardText}"></Button>
										</DataTemplate>
									</ItemsControl.ItemTemplate>
								</ItemsControl>
							</Grid>
						</DataTemplate>
					</ItemsControl.ItemTemplate>
				</ItemsControl>
			</Grid>
		</Grid>
	</Grid>
</UserControl>