2021-03-30 00:09:38 +02:00
|
|
|
<!--
|
|
|
|
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
|
|
|
|
the MIT License. See LICENSE in the project root for license information.
|
|
|
|
-->
|
|
|
|
<Page x:Class="Microsoft.Terminal.Settings.Editor.Interaction"
|
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
|
|
xmlns:local="using:Microsoft.Terminal.Settings.Editor"
|
|
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
|
|
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
|
|
|
mc:Ignorable="d">
|
2020-12-11 22:34:21 +01:00
|
|
|
|
|
|
|
<Page.Resources>
|
|
|
|
<ResourceDictionary>
|
|
|
|
<ResourceDictionary.MergedDictionaries>
|
2021-03-30 00:09:38 +02:00
|
|
|
<ResourceDictionary Source="CommonResources.xaml" />
|
2020-12-11 22:34:21 +01:00
|
|
|
</ResourceDictionary.MergedDictionaries>
|
2021-02-08 19:04:43 +01:00
|
|
|
|
2021-03-30 00:09:38 +02:00
|
|
|
<DataTemplate x:Key="EnumRadioButtonTemplate"
|
|
|
|
x:DataType="local:EnumEntry">
|
|
|
|
<RadioButton Content="{x:Bind EnumName, Mode=OneWay}" />
|
2021-01-15 00:57:59 +01:00
|
|
|
</DataTemplate>
|
2020-12-11 22:34:21 +01:00
|
|
|
</ResourceDictionary>
|
|
|
|
</Page.Resources>
|
2021-02-08 19:04:43 +01:00
|
|
|
|
Manually dismiss popups when the window moves, or the SUI scrolls (#10922)
## Summary of the Pull Request
BODGY!
This solution was suggested in https://github.com/microsoft/microsoft-ui-xaml/issues/4554#issuecomment-887815332.
When the window moves, or when a ScrollViewer scrolls, dismiss any popups that are visible. This happens automagically when an app is a real XAML app, but it doesn't work for XAML Islands.
## References
* upstream at https://github.com/microsoft/microsoft-ui-xaml/issues/4554
## PR Checklist
* [x] Closes #9320
* [x] I work here
* [ ] Tests added/passed
* [ ] Requires documentation to be updated
## Detailed Description of the Pull Request / Additional comments
Unfortunately, we've got a bunch of scroll viewers in our SUI. So I did something bodgyx2 to make our life a little easier.
`DismissAllPopups` can be used to dismiss all popups for a particular UI element. However, we've got a bunch of pages with scroll viewers that may or may not have popups in them. Rather than define the same exact body for all their `ViewChanging` events, the `HasScrollViewer` struct will just do it for you!
Inside the `HasScrollViewer` stuct, we can't get at the `XamlRoot()` that our subclass implements. I mean, _we_ can, but when XAML does it's codegen, _XAML_ won't be able to figure it out.
Fortunately for us, we don't need to! The sender is a UIElement, so we can just get _their_ `XamlRoot()`.
So, you can fix this for any SUI page with just a simple
```diff
- <ScrollViewer>
+ <ScrollViewer ViewChanging="ViewChanging">
```
```diff
- struct AddProfile : AddProfileT<AddProfile>
+ struct AddProfile : public HasScrollViewer<AddProfile>, AddProfileT<AddProfile>
```
## Validation Steps Performed
* the window doesn't close when you move it
* the popups _do_ close when you move the window
* the popups close when you scroll any SUI page
2021-08-16 15:41:17 +02:00
|
|
|
<ScrollViewer ViewChanging="ViewChanging">
|
2020-12-11 22:34:21 +01:00
|
|
|
<StackPanel Style="{StaticResource SettingsStackStyle}">
|
2021-03-30 00:09:38 +02:00
|
|
|
<!-- Copy On Select -->
|
2021-02-08 19:04:43 +01:00
|
|
|
<local:SettingContainer x:Uid="Globals_CopyOnSelect"
|
2021-03-30 00:09:38 +02:00
|
|
|
Margin="0">
|
|
|
|
<ToggleSwitch IsOn="{x:Bind State.Globals.CopyOnSelect, Mode=TwoWay}" />
|
|
|
|
</local:SettingContainer>
|
2020-12-11 22:34:21 +01:00
|
|
|
|
2021-03-30 00:09:38 +02:00
|
|
|
<!-- Copy Format -->
|
2021-02-08 19:04:43 +01:00
|
|
|
<local:SettingContainer x:Uid="Globals_CopyFormat">
|
2021-10-07 19:46:04 +02:00
|
|
|
<muxc:RadioButtons AutomationProperties.AccessibilityView="Content"
|
|
|
|
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
|
2021-03-30 00:09:38 +02:00
|
|
|
ItemsSource="{x:Bind CopyFormatList, Mode=OneWay}"
|
|
|
|
SelectedItem="{x:Bind CurrentCopyFormat, Mode=TwoWay}" />
|
2021-02-08 19:04:43 +01:00
|
|
|
</local:SettingContainer>
|
2021-01-15 00:57:59 +01:00
|
|
|
|
2021-04-24 00:36:51 +02:00
|
|
|
<!-- Trim Block Selection -->
|
|
|
|
<local:SettingContainer x:Uid="Globals_TrimBlockSelection">
|
|
|
|
<ToggleSwitch IsOn="{x:Bind State.Globals.TrimBlockSelection, Mode=TwoWay}" />
|
|
|
|
</local:SettingContainer>
|
|
|
|
|
2021-10-28 17:38:23 +02:00
|
|
|
<!-- Trim Paste -->
|
|
|
|
<local:SettingContainer x:Uid="Globals_TrimPaste">
|
|
|
|
<ToggleSwitch IsOn="{x:Bind State.Globals.TrimPaste, Mode=TwoWay}" />
|
|
|
|
</local:SettingContainer>
|
|
|
|
|
2021-03-30 00:09:38 +02:00
|
|
|
<!-- Word Delimiters -->
|
2021-02-08 19:04:43 +01:00
|
|
|
<local:SettingContainer x:Uid="Globals_WordDelimiters">
|
2021-09-07 19:53:53 +02:00
|
|
|
<TextBox IsSpellCheckEnabled="False"
|
|
|
|
Style="{StaticResource TextBoxSettingStyle}"
|
2021-03-30 00:09:38 +02:00
|
|
|
Text="{x:Bind State.Globals.WordDelimiters, Mode=TwoWay}" />
|
2021-02-08 19:04:43 +01:00
|
|
|
</local:SettingContainer>
|
2020-12-11 22:34:21 +01:00
|
|
|
|
2021-03-30 00:09:38 +02:00
|
|
|
<!-- Snap On Resize -->
|
2021-02-08 19:04:43 +01:00
|
|
|
<local:SettingContainer x:Uid="Globals_SnapToGridOnResize">
|
2021-03-30 00:09:38 +02:00
|
|
|
<ToggleSwitch IsOn="{x:Bind State.Globals.SnapToGridOnResize, Mode=TwoWay}" />
|
2021-02-08 19:04:43 +01:00
|
|
|
</local:SettingContainer>
|
|
|
|
|
2021-03-30 00:09:38 +02:00
|
|
|
<!-- Tab Switcher Mode -->
|
2021-02-08 19:04:43 +01:00
|
|
|
<local:SettingContainer x:Uid="Globals_TabSwitcherMode">
|
2021-10-07 19:46:04 +02:00
|
|
|
<muxc:RadioButtons AutomationProperties.AccessibilityView="Content"
|
|
|
|
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
|
2021-01-15 00:57:59 +01:00
|
|
|
ItemsSource="{x:Bind TabSwitcherModeList}"
|
2021-03-30 00:09:38 +02:00
|
|
|
SelectedItem="{x:Bind CurrentTabSwitcherMode, Mode=TwoWay}" />
|
2021-02-08 19:04:43 +01:00
|
|
|
</local:SettingContainer>
|
2021-02-09 23:18:20 +01:00
|
|
|
|
2021-03-30 00:09:38 +02:00
|
|
|
<!-- Focus Follow Mouse Mode -->
|
2021-02-09 23:18:20 +01:00
|
|
|
<local:SettingContainer x:Uid="Globals_FocusFollowMouse">
|
2021-03-30 00:09:38 +02:00
|
|
|
<ToggleSwitch IsOn="{x:Bind State.Globals.FocusFollowMouse, Mode=TwoWay}" />
|
2021-02-09 23:18:20 +01:00
|
|
|
</local:SettingContainer>
|
2021-05-17 06:20:09 +02:00
|
|
|
|
|
|
|
<!-- Detect URLs -->
|
|
|
|
<local:SettingContainer x:Uid="Globals_DetectURLs">
|
|
|
|
<ToggleSwitch IsOn="{x:Bind State.Globals.DetectURLs, Mode=TwoWay}" />
|
|
|
|
</local:SettingContainer>
|
2020-12-11 22:34:21 +01:00
|
|
|
</StackPanel>
|
|
|
|
</ScrollViewer>
|
|
|
|
</Page>
|