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