-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBindingsOverview.axaml
148 lines (131 loc) · 6.9 KB
/
BindingsOverview.axaml
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
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:TouchGestures.UX.ViewModels"
xmlns:views="clr-namespace:TouchGestures.UX.Views"
xmlns:gestures-views="clr-namespace:TouchGestures.UX.Views.Gestures"
xmlns:containers="clr-namespace:TouchGestures.UX.Controls.Containers"
xmlns:converters="clr-namespace:TouchGestures.UX.Converters"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:DataType="vm:BindingsOverviewViewModel"
x:Class="TouchGestures.UX.Views.BindingsOverview">
<UserControl.Resources>
<converters:TogglableMarginConverter x:Key="TogglableMarginConverter" />
</UserControl.Resources>
<!-- Currently, applying a background from here cause a wall of a stacktrace to appear -->
<!--<Design.PreviewWith>
<views:BindingsOverview Background="{StaticResource BodyColorBrush}" />
</Design.PreviewWith>-->
<Design.DataContext>
<vm:BindingsOverviewViewModel />
</Design.DataContext>
<UserControl.Styles>
<Style Selector="Button#VIEW_Adder">
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Margin" Value="0" />
<Setter Property="Padding" Value="9,11,12,12" />
<Setter Property="IsEnabled" Value="{Binding IsReady}" />
</Style>
<Style Selector="Button#VIEW_Adder:disabled > ContentPresenter">
<Setter Property="Background" Value="Transparent" />
</Style>
<Style Selector="TextBox#VIEW_SearchBar">
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="BorderBrush" Value="{StaticResource InputBorderColorBrush}" />
<Setter Property="Margin" Value="4, 0" />
</Style>
<Style Selector="#VIEW_Body > ContentPresenter">
<Setter Property="Margin" Value="0, 0, 0, 16" />
</Style>
<Style Selector="#VIEW_Body > ContentPresenter:nth-last-child(1)">
<Setter Property="Margin" Value="0, 0, 0, 0" />
</Style>
<Style Selector="ScrollViewer#VIEW_Body">
<Setter Property="IsVisible" Value="{Binding !IsEmpty}" />
<Setter Property="IsEnabled" Value="{Binding !IsEmpty}" />
</Style>
<Style Selector="Grid#VIEW_BodyNoElements">
<Setter Property="IsVisible" Value="{Binding IsEmpty}" />
<Setter Property="IsEnabled" Value="{Binding IsEmpty}" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="0, 0, 0, 32" />
</Style>
</UserControl.Styles>
<ContentControl Content="{Binding NextViewModel}">
<ContentControl.DataTemplates>
<DataTemplate DataType="vm:BindingsOverviewViewModel">
<Grid RowDefinitions="Auto, *, Auto">
<Grid Name="VIEW_Header" ColumnDefinitions="Auto, *, Auto" Grid.Row="0" Margin="0, 32">
<Button Name="VIEW_Adder" Command="{Binding StartSetupWizardCommand}" Grid.Column="0" ToolTip.Tip="Setup a new gesture">
<Grid>
<Image Source="/Assets/Icons/Add.png" Margin="1, 1, 0, 0" IsVisible="{Binding IsReady}" />
<Image Source="/Assets/Icons/Add_disabled.png" Margin="1, 1, 0, 0" IsVisible="{Binding !IsReady}" />
</Grid>
</Button>
<TextBox Name="VIEW_SearchBar" Watermark="Search..." Text="{Binding SearchText}" Grid.Column="1" />
<TextBlock Text="" Width="35" Height="36" Grid.Column="2"/>
</Grid>
<ScrollViewer Grid.Row="1" Margin="23, 0" Grid.IsSharedSizeScope="True">
<ItemsControl Name="VIEW_Body" ItemsSource="{Binding CurrentGestureBindings}" Padding="32, 0">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="vm:GestureBindingDisplayViewModel">
<containers:GestureBindingDisplay />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<Grid Name="VIEW_BodyNoElements" RowDefinitions="Auto, Auto, Auto" Grid.Row="1">
<!-- Margin of 0, 0, 0, 16 if IsReady is true -->
<TextBlock Text="You don't have any gestures set up yet." FontSize="16" FontWeight="Bold" Grid.Row="0">
<TextBlock.Margin>
<MultiBinding Converter="{StaticResource TogglableMarginConverter}">
<Binding Source="0, 0, 0, 16" />
<Binding Path="IsReady" />
</MultiBinding>
</TextBlock.Margin>
</TextBlock>
<TextBlock Text="The daemon is currently not running." Foreground="Red" Grid.Row="1"
IsVisible="{Binding !IsReady}" HorizontalAlignment="Center" Margin="0, 0, 0, 16"/>
<TextBlock Text="Please plug in a touch tablet." Foreground="Red" Grid.Row="1"
HorizontalAlignment="Center" Margin="0, 0, 0, 16">
<TextBlock.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="IsReady" />
<Binding Path="IsTabletsEmpty" />
</MultiBinding>
</TextBlock.IsVisible>
</TextBlock>
<Button Command="{Binding StartSetupWizardCommand}" Content="Setup a new Gesture" Grid.Row="2" HorizontalAlignment="Center">
<Button.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="IsReady" />
<Binding Path="!IsTabletsEmpty" />
</MultiBinding>
</Button.IsVisible>
<Button.IsEnabled>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Source="IsReady" />
<Binding Source="!IsTabletsEmpty" />
</MultiBinding>
</Button.IsEnabled>
</Button>
</Grid>
<Border Background="{StaticResource AccentColorBrush}" BorderThickness="0,2,0,0" Grid.Row="2" Padding="4">
<Grid>
<ComboBox ItemsSource="{Binding Tablets}" SelectedIndex="{Binding SelectedTabletIndex}"
IsEnabled="{Binding IsReady}" HorizontalAlignment="Left" />
<Button Command="{Binding RequestSave}" Content="Save" IsEnabled="{Binding IsReady}" HorizontalAlignment="Right" />
</Grid>
</Border>
</Grid>
</DataTemplate>
<DataTemplate DataType="vm:GestureSetupWizardViewModel">
<gestures-views:GestureSetupWizard />
</DataTemplate>
</ContentControl.DataTemplates>
</ContentControl>
</UserControl>