|
123 | 123 | <Style x:Key="KeyBindingContainerStyle" |
124 | 124 | BasedOn="{StaticResource DefaultListViewItemStyle}" |
125 | 125 | TargetType="ListViewItem"> |
126 | | - <Setter Property="Padding" Value="4" /> |
| 126 | + <Setter Property="Padding" Value="12,4,4,4" /> |
127 | 127 | <Setter Property="HorizontalContentAlignment" Value="Stretch" /> |
128 | 128 | <Setter Property="XYFocusKeyboardNavigation" Value="Enabled" /> |
129 | 129 | </Style> |
|
138 | 138 | <Setter Property="HorizontalAlignment" Value="Right" /> |
139 | 139 | <Setter Property="VerticalAlignment" Value="Center" /> |
140 | 140 | </Style> |
141 | | - <x:Int32 x:Key="EditButtonSize">32</x:Int32> |
142 | | - <x:Double x:Key="EditButtonIconSize">14</x:Double> |
143 | | - <Style x:Key="EditButtonStyle" |
144 | | - BasedOn="{StaticResource DefaultButtonStyle}" |
145 | | - TargetType="Button"> |
146 | | - <Setter Property="Padding" Value="0" /> |
147 | | - <Setter Property="VerticalAlignment" Value="Center" /> |
148 | | - <Setter Property="Height" Value="{StaticResource EditButtonSize}" /> |
149 | | - <Setter Property="Width" Value="{StaticResource EditButtonSize}" /> |
150 | | - </Style> |
151 | | - <Style x:Key="AccentEditButtonStyle" |
152 | | - BasedOn="{StaticResource AccentButtonStyle}" |
153 | | - TargetType="Button"> |
154 | | - <Setter Property="Padding" Value="4" /> |
155 | | - <Setter Property="VerticalAlignment" Value="Center" /> |
156 | | - <Setter Property="Height" Value="{StaticResource EditButtonSize}" /> |
157 | | - <Setter Property="Width" Value="{StaticResource EditButtonSize}" /> |
158 | | - </Style> |
159 | 141 |
|
160 | 142 | <!-- Converters & Misc. --> |
161 | 143 | <SolidColorBrush x:Key="ActionContainerBackgroundEditing" |
|
164 | 146 | Color="Transparent" /> |
165 | 147 |
|
166 | 148 | <!-- Templates --> |
167 | | - <DataTemplate x:Key="KeyBindingTemplate" |
168 | | - x:DataType="local:KeyBindingViewModel"> |
169 | | - <ListViewItem AutomationProperties.AcceleratorKey="{x:Bind KeyChordText, Mode=OneWay}" |
170 | | - AutomationProperties.Name="{x:Bind Name, Mode=OneWay}" |
171 | | - Background="{x:Bind ContainerBackground, Mode=OneWay}" |
172 | | - GotFocus="{x:Bind ActionGotFocus}" |
173 | | - LostFocus="{x:Bind ActionLostFocus}" |
174 | | - PointerEntered="{x:Bind EnterHoverMode}" |
175 | | - PointerExited="{x:Bind ExitHoverMode}" |
| 149 | + <DataTemplate x:Key="CommandTemplate" |
| 150 | + x:DataType="local:CommandViewModel"> |
| 151 | + <ListViewItem AutomationProperties.Name="{x:Bind DisplayNameAndKeyChordAutomationPropName, Mode=OneWay}" |
176 | 152 | Style="{StaticResource KeyBindingContainerStyle}"> |
177 | 153 | <Grid ColumnSpacing="8"> |
178 | 154 | <Grid.ColumnDefinitions> |
179 | 155 | <!-- command name --> |
180 | 156 | <ColumnDefinition Width="*" /> |
181 | 157 | <!-- key chord --> |
182 | 158 | <ColumnDefinition Width="auto" /> |
183 | | - <!-- edit buttons --> |
184 | | - <!-- |
185 | | - This needs to be 112 because that is the width of the row of buttons in edit mode + padding. |
186 | | - 3 buttons: 32+32+32 |
187 | | - Padding: 8+ 8 |
188 | | - This allows the "edit" button to align with the "cancel" button seamlessly |
189 | | - --> |
190 | | - <ColumnDefinition Width="112" /> |
191 | 159 | </Grid.ColumnDefinitions> |
192 | 160 |
|
193 | 161 | <!-- Command Name --> |
194 | 162 | <TextBlock Grid.Column="0" |
195 | 163 | FontWeight="Normal" |
196 | 164 | Style="{StaticResource KeyBindingNameTextBlockStyle}" |
197 | | - Text="{x:Bind Name, Mode=OneWay}" |
198 | | - Visibility="{x:Bind mtu:Converters.InvertedBooleanToVisibility(IsInEditMode), Mode=OneWay}" /> |
199 | | - |
200 | | - <!-- Edit Mode: Action Combo-box --> |
201 | | - <ComboBox x:Uid="Actions_ActionComboBox" |
202 | | - Grid.Column="0" |
203 | | - VerticalAlignment="Center" |
204 | | - ItemsSource="{x:Bind AvailableActions, Mode=OneWay}" |
205 | | - SelectedItem="{x:Bind ProposedAction, Mode=TwoWay}" |
206 | | - Visibility="{x:Bind IsInEditMode, Mode=OneWay}" /> |
207 | | - |
| 165 | + Text="{x:Bind DisplayName, Mode=OneWay}" /> |
208 | 166 | <!-- Key Chord Text --> |
209 | 167 | <Border Grid.Column="1" |
210 | | - Padding="2,0,2,0" |
| 168 | + Padding="8,4,8,4" |
211 | 169 | HorizontalAlignment="Right" |
212 | 170 | VerticalAlignment="Center" |
213 | 171 | Style="{ThemeResource KeyChordBorderStyle}" |
214 | | - Visibility="{x:Bind mtu:Converters.InvertedBooleanToVisibility(IsInEditMode), Mode=OneWay}"> |
215 | | - |
| 172 | + Visibility="{x:Bind mtu:Converters.StringNotEmptyToVisibility(FirstKeyChordText)}"> |
216 | 173 | <TextBlock FontSize="14" |
217 | 174 | Style="{ThemeResource KeyChordTextBlockStyle}" |
218 | | - Text="{x:Bind KeyChordText, Mode=OneWay}" |
| 175 | + Text="{x:Bind FirstKeyChordText, Mode=OneWay}" |
219 | 176 | TextWrapping="WrapWholeWords" /> |
220 | 177 | </Border> |
221 | | - |
222 | | - <!-- Edit Mode: Key Chord Listener --> |
223 | | - <local:KeyChordListener Grid.Column="1" |
224 | | - Keys="{x:Bind ProposedKeys, Mode=TwoWay}" |
225 | | - Style="{StaticResource KeyChordEditorStyle}" |
226 | | - Visibility="{x:Bind IsInEditMode, Mode=OneWay}" /> |
227 | | - |
228 | | - <!-- Edit Button --> |
229 | | - <Button x:Uid="Actions_EditButton" |
230 | | - Grid.Column="2" |
231 | | - AutomationProperties.Name="{x:Bind EditButtonName}" |
232 | | - Background="Transparent" |
233 | | - Click="{x:Bind ToggleEditMode}" |
234 | | - GettingFocus="{x:Bind EditButtonGettingFocus}" |
235 | | - LosingFocus="{x:Bind EditButtonLosingFocus}" |
236 | | - Style="{StaticResource EditButtonStyle}" |
237 | | - Visibility="{x:Bind ShowEditButton, Mode=OneWay}"> |
238 | | - <Button.Content> |
239 | | - <FontIcon FontSize="{StaticResource EditButtonIconSize}" |
240 | | - Glyph="" /> |
241 | | - </Button.Content> |
242 | | - <Button.Resources> |
243 | | - <ResourceDictionary> |
244 | | - <ResourceDictionary.ThemeDictionaries> |
245 | | - <ResourceDictionary x:Key="Light"> |
246 | | - <SolidColorBrush x:Key="ButtonForegroundPointerOver" |
247 | | - Color="{StaticResource SystemAccentColor}" /> |
248 | | - <SolidColorBrush x:Key="ButtonForegroundPressed" |
249 | | - Color="{StaticResource SystemAccentColor}" /> |
250 | | - </ResourceDictionary> |
251 | | - <ResourceDictionary x:Key="Dark"> |
252 | | - <SolidColorBrush x:Key="ButtonForegroundPointerOver" |
253 | | - Color="{StaticResource SystemAccentColor}" /> |
254 | | - <SolidColorBrush x:Key="ButtonForegroundPressed" |
255 | | - Color="{StaticResource SystemAccentColor}" /> |
256 | | - </ResourceDictionary> |
257 | | - <ResourceDictionary x:Key="HighContrast"> |
258 | | - <SolidColorBrush x:Key="ButtonBackground" |
259 | | - Color="{ThemeResource SystemColorButtonFaceColor}" /> |
260 | | - <SolidColorBrush x:Key="ButtonBackgroundPointerOver" |
261 | | - Color="{ThemeResource SystemColorHighlightColor}" /> |
262 | | - <SolidColorBrush x:Key="ButtonBackgroundPressed" |
263 | | - Color="{ThemeResource SystemColorHighlightColor}" /> |
264 | | - <SolidColorBrush x:Key="ButtonForeground" |
265 | | - Color="{ThemeResource SystemColorButtonTextColor}" /> |
266 | | - <SolidColorBrush x:Key="ButtonForegroundPointerOver" |
267 | | - Color="{ThemeResource SystemColorHighlightTextColor}" /> |
268 | | - <SolidColorBrush x:Key="ButtonForegroundPressed" |
269 | | - Color="{ThemeResource SystemColorHighlightTextColor}" /> |
270 | | - </ResourceDictionary> |
271 | | - </ResourceDictionary.ThemeDictionaries> |
272 | | - </ResourceDictionary> |
273 | | - </Button.Resources> |
274 | | - </Button> |
275 | | - |
276 | | - <!-- Edit Mode: Buttons --> |
277 | | - <StackPanel Grid.Column="2" |
278 | | - Orientation="Horizontal" |
279 | | - Visibility="{x:Bind IsInEditMode, Mode=OneWay}"> |
280 | | - |
281 | | - <!-- Cancel editing the action --> |
282 | | - <Button x:Uid="Actions_CancelButton" |
283 | | - AutomationProperties.Name="{x:Bind CancelButtonName}" |
284 | | - Click="{x:Bind CancelChanges}" |
285 | | - Style="{StaticResource EditButtonStyle}"> |
286 | | - <FontIcon FontSize="{StaticResource EditButtonIconSize}" |
287 | | - Glyph="" /> |
288 | | - </Button> |
289 | | - |
290 | | - <!-- Accept changes --> |
291 | | - <Button x:Uid="Actions_AcceptButton" |
292 | | - Margin="8,0,0,0" |
293 | | - AutomationProperties.Name="{x:Bind AcceptButtonName}" |
294 | | - Click="{x:Bind AttemptAcceptChanges}" |
295 | | - Flyout="{x:Bind AcceptChangesFlyout, Mode=OneWay}" |
296 | | - Style="{StaticResource AccentEditButtonStyle}"> |
297 | | - <FontIcon FontSize="{StaticResource EditButtonIconSize}" |
298 | | - Glyph="" /> |
299 | | - </Button> |
300 | | - |
301 | | - <!-- Delete the current key binding --> |
302 | | - <Button x:Uid="Actions_DeleteButton" |
303 | | - Margin="8,0,0,0" |
304 | | - AutomationProperties.Name="{x:Bind DeleteButtonName}" |
305 | | - Style="{StaticResource DeleteSmallButtonStyle}" |
306 | | - Visibility="{x:Bind mtu:Converters.InvertedBooleanToVisibility(IsNewlyAdded), Mode=OneWay}"> |
307 | | - <Button.Content> |
308 | | - <FontIcon FontSize="{StaticResource EditButtonIconSize}" |
309 | | - Glyph="" /> |
310 | | - </Button.Content> |
311 | | - <Button.Flyout> |
312 | | - <Flyout FlyoutPresenterStyle="{StaticResource CustomFlyoutPresenterStyle}"> |
313 | | - <StackPanel> |
314 | | - <TextBlock x:Uid="Actions_DeleteConfirmationMessage" |
315 | | - Style="{StaticResource CustomFlyoutTextStyle}" /> |
316 | | - <Button x:Uid="Actions_DeleteConfirmationButton" |
317 | | - Click="{x:Bind DeleteKeyBinding}" /> |
318 | | - </StackPanel> |
319 | | - </Flyout> |
320 | | - </Button.Flyout> |
321 | | - </Button> |
322 | | - </StackPanel> |
323 | 178 | </Grid> |
324 | 179 | </ListViewItem> |
325 | 180 | </DataTemplate> |
|
331 | 186 | HorizontalAlignment="Left" |
332 | 187 | Spacing="8" |
333 | 188 | Style="{StaticResource SettingsStackStyle}"> |
| 189 | + <HyperlinkButton x:Uid="Actions_Disclaimer" |
| 190 | + Margin="0" |
| 191 | + Padding="0" |
| 192 | + NavigateUri="https://go.microsoft.com/fwlink/?linkid=2341386" /> |
334 | 193 | <!-- Add New Button --> |
335 | 194 | <Button x:Name="AddNewButton" |
336 | 195 | Margin="0,12,0,0" |
337 | | - Click="AddNew_Click"> |
| 196 | + Click="{x:Bind ViewModel.AddNewCommand}"> |
338 | 197 | <Button.Content> |
339 | 198 | <StackPanel Orientation="Horizontal"> |
340 | 199 | <FontIcon FontSize="{StaticResource StandardIconSize}" |
|
345 | 204 | </Button.Content> |
346 | 205 | </Button> |
347 | 206 |
|
348 | | - <!-- Keybindings --> |
349 | | - <ListView x:Name="KeyBindingsListView" |
350 | | - ItemTemplate="{StaticResource KeyBindingTemplate}" |
351 | | - ItemsSource="{x:Bind ViewModel.KeyBindingList, Mode=OneWay}" |
352 | | - SelectionMode="None" /> |
| 207 | + <!-- Commands --> |
| 208 | + <ListView x:Name="CommandsListView" |
| 209 | + Margin="-8,0,0,0" |
| 210 | + IsItemClickEnabled="True" |
| 211 | + ItemClick="{x:Bind ViewModel.CmdListItemClicked}" |
| 212 | + ItemTemplate="{StaticResource CommandTemplate}" |
| 213 | + ItemsSource="{x:Bind ViewModel.CommandList, Mode=OneWay}" /> |
353 | 214 | </StackPanel> |
354 | 215 | </Border> |
355 | 216 | </Page> |
0 commit comments