-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathNewEntryDialog.xaml
145 lines (137 loc) · 8.01 KB
/
NewEntryDialog.xaml
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
<dialogs:CustomDialog x:Class="bagpipe.NewEntryDialog"
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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:dialogs="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:local="clr-namespace:bagpipe"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=local:NewEntryViewModel}"
d:DesignHeight="450" d:DesignWidth="800" KeyDown="MainForm_KeyDown">
<Control.Resources>
<local:CastingConverter x:Key="DoubleCastingConverter" ResultType="{x:Type sys:Double}" />
<Style TargetType="{x:Type TextBlock}" BasedOn="{mah:StaticResource MahApps.Styles.TextBlock}">
<Setter Property="FontSize"
Value="{Binding DialogMessageFontSize,
RelativeSource={RelativeSource AncestorType=local:NewEntryDialog, Mode=FindAncestor},
UpdateSourceTrigger=PropertyChanged}" />
<Setter Property="Foreground"
Value="{Binding Foreground,
RelativeSource={RelativeSource AncestorType=local:NewEntryDialog, Mode=FindAncestor},
UpdateSourceTrigger=PropertyChanged}" />
</Style>
<ObjectDataProvider x:Key="TypeEnumValues" ObjectType="{x:Type sys:Enum}" MethodName="GetValues" >
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="local:SettingsDataType"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</Control.Resources>
<Grid Margin="-20,10,-20,0">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Grid.Row="0"
HorizontalAlignment="Center" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="50"/>
<ColumnDefinition Width="65"/>
<ColumnDefinition Width="120"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0"
Margin="0,0,10,10"
VerticalAlignment="Center"
Text="Preset" />
<ComboBox Grid.Row="0" Grid.Column="1"
Margin="0,0,0,10"
ItemsSource="{Binding ValidGames, Mode=OneTime}"
SelectedValue="{Binding DisplayGame}"/>
<ComboBox x:Name="PresetComboBox"
Grid.Row="0" Grid.Column="2"
Margin="0,0,0,10"
ItemsSource="{Binding Presets}"
DisplayMemberPath="Name"
mah:TextBoxHelper.Watermark="n/a" />
<TextBlock Grid.Row="1" Grid.Column="0"
Margin="0,0,10,0"
VerticalAlignment="Center"
Text="ID" />
<mah:NumericUpDown Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2"
Minimum="{Binding Source={x:Static sys:Int32.MinValue},
Mode=OneTime,
Converter={StaticResource DoubleCastingConverter},
ConverterParameter={x:Type sys:Int32}}"
Maximum="{Binding Source={x:Static sys:Int32.MaxValue},
Mode=OneTime,
Converter={StaticResource DoubleCastingConverter},
ConverterParameter={x:Type sys:Int32}}"
Value="{Binding ID,
Converter={StaticResource DoubleCastingConverter},
ConverterParameter={x:Type sys:Int32}}"
NumericInputMode="Numbers"
ParsingNumberStyle="Integer,AllowThousands" />
<TextBlock Grid.Row="2" Grid.Column="0"
Margin="0,1,10,0"
VerticalAlignment="Center"
Text="Type" />
<ComboBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2"
Margin="0,1,0,0"
ItemsSource="{Binding Source={StaticResource TypeEnumValues},
Mode=OneTime}"
SelectedValue="{Binding Type}"/>
<TextBlock Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3"
TextWrapping="Wrap"
Margin="0,3,0,0">
This type has not been observed in practice, so may not be written to disk correctly.
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}" BasedOn="{mah:StaticResource MahApps.Styles.TextBlock}">
<Setter Property="Visibility" Value="Visible" />
<Setter Property="Foreground"
Value="{Binding Foreground,
RelativeSource={RelativeSource AncestorType=local:NewEntryDialog, Mode=FindAncestor},
UpdateSourceTrigger=PropertyChanged}" />
<Style.Triggers>
<DataTrigger Binding="{Binding Type}" Value="{x:Static local:SettingsDataType.Int32}">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
<DataTrigger Binding="{Binding Type}" Value="{x:Static local:SettingsDataType.String}">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
<DataTrigger Binding="{Binding Type}" Value="{x:Static local:SettingsDataType.Float}">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
<DataTrigger Binding="{Binding Type}" Value="{x:Static local:SettingsDataType.Blob}">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
<DataTrigger Binding="{Binding Type}" Value="{x:Static local:SettingsDataType.Byte}">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
<StackPanel Grid.Row="1"
MinHeight="85"
HorizontalAlignment="Right"
Orientation="Horizontal">
<Button Content="Add"
mah:ControlsHelper.ContentCharacterCasing="Upper"
Style="{DynamicResource MahApps.Styles.Button.Dialogs.Accent}"
Click="AddButton_Click" KeyDown="AddButton_KeyDown"/>
<Button Margin="10,0,0,0"
Content="Cancel"
mah:ControlsHelper.ContentCharacterCasing="Upper"
Style="{DynamicResource MahApps.Styles.Button.Dialogs}"
Click="CancelButton_Click" KeyDown="CancelButton_KeyDown" />
</StackPanel>
</Grid>
</dialogs:CustomDialog>