<local:NavigablePage
    x:Class="Microsoft.PowerToys.Settings.UI.Views.PeekPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="using:Microsoft.PowerToys.Settings.UI.Helpers"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
    xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
    xmlns:ui="using:CommunityToolkit.WinUI"
    AutomationProperties.LandmarkType="Main"
    mc:Ignorable="d">

    <controls:SettingsPageControl x:Uid="Peek" ModuleImageSource="ms-appx:///Assets/Settings/Modules/Peek.png">
        <controls:SettingsPageControl.ModuleContent>
            <StackPanel Orientation="Vertical">
                <controls:GPOInfoControl ShowWarning="{x:Bind ViewModel.IsEnabledGpoConfigured, Mode=OneWay}">
                    <tkcontrols:SettingsCard
                        Name="PeekEnablePeek"
                        x:Uid="Peek_EnablePeek"
                        HeaderIcon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Peek.png}">
                        <ToggleSwitch IsOn="{x:Bind ViewModel.IsEnabled, Mode=TwoWay}" />
                    </tkcontrols:SettingsCard>
                </controls:GPOInfoControl>

                <controls:SettingsGroup x:Uid="Peek_Activation_GroupSettings" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
                    <tkcontrols:SettingsCard x:Uid="Peek_ActivationMethod">
                        <ComboBox SelectedIndex="{x:Bind ViewModel.EnableSpaceToActivate, Mode=TwoWay, Converter={StaticResource BoolToComboBoxIndexConverter}}">
                            <ComboBoxItem x:Uid="Peek_ActivationMethod_CustomizedShortcut" />
                            <ComboBoxItem x:Uid="Peek_ActivationMethod_SpaceBar" />
                        </ComboBox>
                    </tkcontrols:SettingsCard>
                    <tkcontrols:SettingsCard
                        Name="ActivationShortcut"
                        x:Uid="Activation_Shortcut"
                        HeaderIcon="{ui:FontIcon Glyph=&#xEDA7;}"
                        Visibility="{x:Bind ViewModel.EnableSpaceToActivate, Mode=OneWay, Converter={StaticResource ReverseBoolToVisibilityConverter}}">
                        <controls:ShortcutControl HotkeySettings="{x:Bind Path=ViewModel.ActivationShortcut, Mode=TwoWay}" />
                    </tkcontrols:SettingsCard>
                </controls:SettingsGroup>
                <controls:SettingsGroup x:Uid="Peek_BehaviorHeader" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
                    <tkcontrols:SettingsCard
                        Name="PeekAlwaysRunNotElevated"
                        x:Uid="Peek_AlwaysRunNotElevated"
                        HeaderIcon="{ui:FontIcon Glyph=&#xE7EF;}">
                        <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.AlwaysRunNotElevated, Mode=TwoWay}" />
                    </tkcontrols:SettingsCard>
                    <tkcontrols:SettingsCard
                        Name="PeekCloseAfterLosingFocus"
                        x:Uid="Peek_CloseAfterLosingFocus"
                        HeaderIcon="{ui:FontIcon Glyph=&#xED1A;}">
                        <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.CloseAfterLosingFocus, Mode=TwoWay}" />
                    </tkcontrols:SettingsCard>
                    <tkcontrols:SettingsCard
                        Name="PeekConfirmFileDelete"
                        x:Uid="Peek_ConfirmFileDelete"
                        HeaderIcon="{ui:FontIcon Glyph=&#xE7BA;}">
                        <ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.ConfirmFileDelete, Mode=TwoWay}" />
                    </tkcontrols:SettingsCard>
                </controls:SettingsGroup>

                <controls:SettingsGroup x:Uid="Peek_Preview_GroupSettings" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
                    <tkcontrols:SettingsExpander
                        Name="PeekSourceCodeHeader"
                        x:Uid="Peek_SourceCode_Header"
                        HeaderIcon="{ui:FontIcon Glyph=&#xE99A;}"
                        IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
                        <tkcontrols:SettingsExpander.Items>
                            <tkcontrols:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
                                <CheckBox x:Uid="Peek_SourceCode_WrapText" IsChecked="{x:Bind ViewModel.SourceCodeWrapText, Mode=TwoWay}" />
                            </tkcontrols:SettingsCard>
                            <tkcontrols:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
                                <ptcontrols:CheckBoxWithDescriptionControl
                                    x:Uid="Peek_SourceCode_TryFormat"
                                    IsChecked="{x:Bind ViewModel.SourceCodeTryFormat, Mode=TwoWay}"
                                    IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}" />
                            </tkcontrols:SettingsCard>
                            <tkcontrols:SettingsCard
                                Name="PeekSourceCodeFontSize"
                                x:Uid="Peek_SourceCode_FontSize"
                                IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
                                <NumberBox
                                    MinWidth="{StaticResource SettingActionControlMinWidth}"
                                    Maximum="100"
                                    Minimum="2"
                                    SpinButtonPlacementMode="Compact"
                                    Value="{x:Bind ViewModel.SourceCodeFontSize, Mode=TwoWay}" />
                            </tkcontrols:SettingsCard>
                            <tkcontrols:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
                                <CheckBox x:Uid="Peek_SourceCode_StickyScroll" IsChecked="{x:Bind ViewModel.SourceCodeStickyScroll, Mode=TwoWay}" />
                            </tkcontrols:SettingsCard>
                            <tkcontrols:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
                                <CheckBox x:Uid="Peek_SourceCode_Minimap" IsChecked="{x:Bind ViewModel.SourceCodeMinimap, Mode=TwoWay}" />
                            </tkcontrols:SettingsCard>
                        </tkcontrols:SettingsExpander.Items>
                    </tkcontrols:SettingsExpander>
                </controls:SettingsGroup>

            </StackPanel>
        </controls:SettingsPageControl.ModuleContent>
        <controls:SettingsPageControl.PrimaryLinks>
            <controls:PageLink x:Uid="LearnMore_Peek" Link="https://aka.ms/PowerToysOverview_Peek" />
        </controls:SettingsPageControl.PrimaryLinks>
    </controls:SettingsPageControl>
</local:NavigablePage>
