<Page
    x:Class="Microsoft.PowerToys.Settings.UI.Views.ShortcutGuidePage"
    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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
    xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
    xmlns:converters="using:Microsoft.Toolkit.Uwp.UI.Converters"
    mc:Ignorable="d"
    AutomationProperties.LandmarkType="Main">

    <Page.Resources>
        <converters:StringFormatConverter x:Key="StringFormatConverter"/>
        <converters:BoolToObjectConverter x:Key="BoolToComboBoxIndexConverter" TrueValue="1" FalseValue="0"/>
        <converters:BoolToVisibilityConverter x:Key="TrueToVisibleConverter" TrueValue="Visible" FalseValue="Collapsed"/>
        <converters:BoolToVisibilityConverter x:Key="FalseToVisibleConverter" TrueValue="Collapsed" FalseValue="Visible"/>
    </Page.Resources>

    <controls:SettingsPageControl x:Uid="ShortcutGuide"
                                  ModuleImageSource="ms-appx:///Assets/Modules/ShortcutGuide.png">
        <controls:SettingsPageControl.ModuleContent>
            <StackPanel Orientation="Vertical">
                <controls:Setting x:Uid="ShortcutGuide_Enable">
                    <controls:Setting.Icon>
                        <BitmapIcon UriSource="ms-appx:///Assets/FluentIcons/FluentIconsShortcutGuide.png" ShowAsMonochrome="False" />
                    </controls:Setting.Icon>
                    <controls:Setting.ActionContent>
                        <ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.IsEnabled}" x:Uid="ToggleSwitch"/>
                    </controls:Setting.ActionContent>
                </controls:Setting>

                <controls:SettingsGroup x:Uid="Shortcut" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">

                    <controls:Setting x:Uid="ShortcutGuide_ActivationMethod">
                        <controls:Setting.ActionContent>
                            <ComboBox SelectedIndex="{x:Bind Mode=TwoWay, Path=ViewModel.UseLegacyPressWinKeyBehavior, Converter={StaticResource BoolToComboBoxIndexConverter}}" MinWidth="{StaticResource SettingActionControlMinWidth}">
                                <ComboBoxItem x:Uid="Radio_ShortcutGuide_ActivationMethod_CustomizedShortcut"/>
                                <ComboBoxItem x:Uid="Radio_ShortcutGuide_ActivationMethod_LongPressWindowsKey"/>
                            </ComboBox>
                        </controls:Setting.ActionContent>
                    </controls:Setting>

                    <controls:Setting x:Uid="Activation_Shortcut" Icon="&#xEDA7;" Visibility="{x:Bind Mode=OneWay, Path=ViewModel.UseLegacyPressWinKeyBehavior, Converter={StaticResource FalseToVisibleConverter}}">
                        <controls:Setting.ActionContent>
                            <controls:ShortcutControl HotkeySettings="{x:Bind Path=ViewModel.OpenShortcutGuide, Mode=TwoWay}"
                                                            MinWidth="{StaticResource SettingActionControlMinWidth}"/>
                        </controls:Setting.ActionContent>
                    </controls:Setting>

                    <controls:Setting x:Uid="ShortcutGuide_PressTime" Icon="&#xE916;" Visibility="{x:Bind Mode=OneWay, Path=ViewModel.UseLegacyPressWinKeyBehavior, Converter={StaticResource TrueToVisibleConverter}}">
                        <controls:Setting.ActionContent>
                            <muxc:NumberBox
                                Minimum="100"
                                Value="{x:Bind Mode=TwoWay, Path=ViewModel.PressTime}"
                                MinWidth="{StaticResource SettingActionControlMinWidth}"
                                SpinButtonPlacementMode="Compact"
                                HorizontalAlignment="Left"
                                SmallChange="50"
                                LargeChange="100"
                            />
                        </controls:Setting.ActionContent>
                    </controls:Setting>

                    <muxc:InfoBar
                        x:Uid="ShortcutGuide_PressWinKeyWarning"
                        Severity="Warning"
                        IsTabStop="True"
                        IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.UseLegacyPressWinKeyBehavior}"
                        IsClosable="False"
                    />

                </controls:SettingsGroup>

                <controls:SettingsGroup x:Uid="ShortcutGuide_Appearance_Behavior" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">

                    <controls:Setting x:Uid="ColorModeHeader" Icon="&#xE790;">
                                <controls:Setting.Description>
                                    <HyperlinkButton Click="OpenColorsSettings_Click"
                                                     x:Uid="Windows_Color_Settings"/>
                                </controls:Setting.Description>
                                <controls:Setting.ActionContent>
                                    <ComboBox SelectedIndex="{x:Bind Mode=TwoWay, Path=ViewModel.ThemeIndex}" MinWidth="{StaticResource SettingActionControlMinWidth}">
                                        <ComboBoxItem x:Uid="Radio_Theme_Dark"/>
                                        <ComboBoxItem x:Uid="Radio_Theme_Light"/>
                                        <ComboBoxItem x:Uid="Radio_Theme_Default"/>
                                    </ComboBox>
                                </controls:Setting.ActionContent>
                            </controls:Setting>


                    <controls:Setting x:Uid="ShortcutGuide_OverlayOpacity">
                        <controls:Setting.ActionContent>
                            <Slider Minimum="0"
                                                Maximum="100"
                                                MinWidth="{StaticResource SettingActionControlMinWidth}"
                                                Value="{x:Bind Mode=TwoWay, Path=ViewModel.OverlayOpacity}"/>
                        </controls:Setting.ActionContent>
                    </controls:Setting>
                </controls:SettingsGroup>

                <controls:SettingsGroup x:Uid="ExcludedApps" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
                    <controls:SettingExpander IsExpanded="True">
                        <controls:SettingExpander.Header>
                            <controls:Setting x:Uid="ShortcutGuide_DisabledApps" Icon="&#xECE4;" Style="{StaticResource ExpanderHeaderSettingStyle}"/>
                        </controls:SettingExpander.Header>
                        <controls:SettingExpander.Content>
                            <TextBox x:Uid="ShortcutGuide_DisabledApps_TextBoxControl"
                                     Margin="{StaticResource ExpanderSettingMargin}"
                                         Text="{x:Bind Mode=TwoWay, Path=ViewModel.DisabledApps, UpdateSourceTrigger=PropertyChanged}"
                                         ScrollViewer.VerticalScrollBarVisibility ="Visible"
                                         ScrollViewer.VerticalScrollMode="Enabled"
                                         ScrollViewer.IsVerticalRailEnabled="True"
                                         TextWrapping="Wrap"
                                         AcceptsReturn="True"
                                         MinWidth="240"
                                         MinHeight="160" />
                        </controls:SettingExpander.Content>
                    </controls:SettingExpander>
                </controls:SettingsGroup>
            </StackPanel>
        </controls:SettingsPageControl.ModuleContent>
        <controls:SettingsPageControl.PrimaryLinks>
            <controls:PageLink x:Uid="LearnMore_ShortcutGuide" Link="https://aka.ms/PowerToysOverview_ShortcutGuide"/>
        </controls:SettingsPageControl.PrimaryLinks>
    </controls:SettingsPageControl>
</Page>