<ui:Page xmlns:props="clr-namespace:Ink_Canvas.Properties" x:Class="Ink_Canvas.Windows.SettingsViews.Pages.WindowPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews.Pages"
      xmlns:helpers="clr-namespace:Ink_Canvas.Windows.SettingsViews.Helpers"
      xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
      xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
      xmlns:sys="clr-namespace:System;assembly=mscorlib"
      xmlns:controls="clr-namespace:Ink_Canvas.Controls;assembly=InkCanvas.Controls"
      xmlns:c="clr-namespace:Ink_Canvas.Converter"
      mc:Ignorable="d"

      Title="{x:Static props:WindowStrings.Title}">

    <ScrollViewer PanningMode="VerticalFirst">
        <Grid Margin="59,0,59,0">
            <FrameworkElement.Resources>
            <sys:Double x:Key="SettingsCardSpacing">4</sys:Double>
            <c:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
            <Style TargetType="ui:FontIcon">
                <Setter Property="FontSize" Value="24" />
            </Style>
            <Style x:Key="SettingsSectionHeaderTextBlockStyle"
                BasedOn="{StaticResource BodyStrongTextBlockStyle}"
                TargetType="TextBlock">
                <Style.Setters>
                    <Setter Property="Margin" Value="1,30,0,6" />
                </Style.Setters>
            </Style>
        </FrameworkElement.Resources>
            <Grid>
                <ikw:SimpleStackPanel MaxWidth="1000"
                    HorizontalAlignment="Stretch"
                    Spacing="{StaticResource SettingsCardSpacing}">

                    <TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
                        Text="{x:Static props:WindowStrings.WindowSettings}" />

                    <controls:LabeledSettingsCard x:Name="CardNoFocusMode"
                            Header="{x:Static props:StartupStrings.NoFocusMode}"
                            Description="{x:Static props:StartupStrings.NoFocusModeHint}"
                            Icon="{x:Static ui:SegoeFluentIcons.View}"
                            SwitchName="ToggleSwitchNoFocusMode"
                            Toggled="ToggleSwitchNoFocusMode_Toggled" />

                    <controls:LabeledSettingsCard x:Name="CardWindowMode"
                            Header="{x:Static props:StartupStrings.NoBorderMode}"
                            Description="{x:Static props:StartupStrings.NoBorderModeHint}"
                            Icon="{x:Static ui:SegoeFluentIcons.FullScreen}"
                            SwitchName="ToggleSwitchWindowMode"
                            Toggled="ToggleSwitchWindowMode_Toggled" />

                    <controls:LabeledSettingsCard x:Name="CardWindowChromeRendering"
                            Header="{x:Static props:WindowStrings.Window_WindowChromeRendering}"
                            Description="{x:Static props:WindowStrings.Window_WindowChromeRenderingHint}"
                            Icon="{x:Static ui:SegoeFluentIcons.SpeedHigh}"
                            SwitchName="ToggleSwitchWindowChromeRendering"
                            Toggled="ToggleSwitchWindowChromeRendering_Toggled" />

                    <controls:LabeledSettingsCard x:Name="CardAvoidFullScreen"
                            Header="{x:Static props:AdvancedStrings.AvoidFullScreenHelper}"
                            Description="{x:Static props:AdvancedStrings.AvoidFullScreenHelperHint}"
                            Icon="{x:Static ui:SegoeFluentIcons.Cancel}"
                            SwitchName="ToggleSwitchAvoidFullScreen"
                            Toggled="ToggleSwitchAvoidFullScreen_Toggled" />

                    <controls:LabeledSettingsCard x:Name="CardMultiScreenSupport"
                            Header="{x:Static props:WindowStrings.MultiScreenSupport}"
                            Description="{x:Static props:WindowStrings.MultiScreenSupportHint}"
                            SwitchName="ToggleSwitchMultiScreenSupport"
                            Toggled="ToggleSwitchMultiScreenSupport_Toggled">
                        <controls:LabeledSettingsCard.HeaderIcon>
                            <ui:FontIcon Icon="{x:Static ui:FluentSystemIcons.Desktop_24_Regular}" />
                        </controls:LabeledSettingsCard.HeaderIcon>
                    </controls:LabeledSettingsCard>

                    <controls:LabeledSettingsCard x:Name="CardFollowMouseScreen"
                            Header="{x:Static props:WindowStrings.FollowMouseScreen}"
                            Description="{x:Static props:WindowStrings.FollowMouseScreenHint}"
                            Visibility="{Binding IsOn, ElementName=CardMultiScreenSupport, Converter={StaticResource BooleanToVisibilityConverter}}"
                            SwitchName="ToggleSwitchFollowMouseScreen"
                            Toggled="ToggleSwitchFollowMouseScreen_Toggled">
                        <controls:LabeledSettingsCard.HeaderIcon>
                            <ui:FontIcon Icon="{x:Static ui:FluentSystemIcons.Desktop_24_Regular}" />
                        </controls:LabeledSettingsCard.HeaderIcon>
                    </controls:LabeledSettingsCard>

                    <ui:SettingsExpander x:Name="ExpanderAlwaysOnTop"
                            Header="{x:Static props:StartupStrings.TopMost}"
                            Description="{x:Static props:StartupStrings.TopMostHint}"
                            IsExpanded="{Binding IsOn, ElementName=ToggleSwitchAlwaysOnTop, Mode=OneWay}"
                            d:Visibility="Visible" d:IsExpanded="True">
                        <ui:SettingsExpander.HeaderIcon>
                            <ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Pinned}" />
                        </ui:SettingsExpander.HeaderIcon>
                        <ui:ToggleSwitch x:Name="ToggleSwitchAlwaysOnTop"
                                Toggled="ToggleSwitchAlwaysOnTop_Toggled" />
                        <ui:SettingsExpander.ItemTemplate>
                            <helpers:TopMostModeTemplateSelector>
                                <helpers:TopMostModeTemplateSelector.SelectionTemplate>
                                    <DataTemplate>
                                        <ui:SettingsCard Header="{x:Static props:StartupStrings.TopMostMode}">
                                            <StackPanel Orientation="Horizontal">
                                                <RadioButton Content="{x:Static props:StartupStrings.TopMostMode_Normal}"
                                                        GroupName="TopMostMode"
                                                        Checked="RadioTopMostNormal_Checked"
                                                        Loaded="RadioTopMostNormal_Loaded"
                                                        Margin="0,0,16,0" />
                                                <RadioButton Content="{x:Static props:StartupStrings.TopMostMode_UIA}"
                                                        GroupName="TopMostMode"
                                                        Checked="RadioTopMostUIA_Checked"
                                                        Loaded="RadioTopMostUIA_Loaded" />
                                            </StackPanel>
                                        </ui:SettingsCard>
                                    </DataTemplate>
                                </helpers:TopMostModeTemplateSelector.SelectionTemplate>
                                <helpers:TopMostModeTemplateSelector.ButtonTemplate>
                                    <DataTemplate>
                                        <ui:SettingsCard Header="{Binding ButtonHeader}">
                                            <Button Content="{Binding ButtonContent}"
                                                    Click="BtnRestart_Click"
                                                    Tag="{Binding RestartAsAdmin}" />
                                        </ui:SettingsCard>
                                    </DataTemplate>
                                </helpers:TopMostModeTemplateSelector.ButtonTemplate>
                            </helpers:TopMostModeTemplateSelector>
                        </ui:SettingsExpander.ItemTemplate>
                    </ui:SettingsExpander>

                    <ui:SettingsCard x:Name="CardUIAMode"
                            Header="{x:Static props:StartupStrings.UIAMode_Label}"
                            Description="{x:Static props:StartupStrings.UIAMode_Description}"
                            Visibility="Collapsed"
                            Margin="0,-2,0,0">
                        <ui:SettingsCard.HeaderIcon>
                            <ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Admin}" />
                        </ui:SettingsCard.HeaderIcon>
                        <ComboBox x:Name="ComboBoxUIAMode"
                                SelectionChanged="ComboBoxUIAMode_SelectionChanged"
                                MinWidth="180" />
                    </ui:SettingsCard>

                    <Rectangle Height="48" />

                </ikw:SimpleStackPanel>
            </Grid>
        </Grid>
    </ScrollViewer>
</ui:Page>
