<Page x:Class="ModernFlyouts.Navigation.PersonalizationPage"
      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:ModernFlyouts" xmlns:ui="http://schemas.modernwpf.com/2019"
      xmlns:toolkit="http://schemas.modernwpf.com/toolkit"
      xmlns:controls="clr-namespace:ModernFlyouts.Controls"
      xmlns:utils="clr-namespace:ModernFlyouts.Utilities"
      xmlns:helpers="clr-namespace:ModernFlyouts.Helpers"
      xmlns:resx="clr-namespace:ModernFlyouts.Properties"
      xmlns:localui="clr-namespace:ModernFlyouts.UI"
      mc:Ignorable="d"
      d:DesignHeight="450" d:DesignWidth="800" DataContext="{x:Static local:FlyoutHandler.Instance}">
    <controls:ScrollViewerEx VerticalScrollBarVisibility="Auto">
        <StackPanel Margin="20,10">
            <GroupBox Header="{x:Static resx:Strings.Settings_Appearance}">
                <ui:SimpleStackPanel Spacing="10">
                    <ui:RadioButtons Header="{x:Static resx:Strings.Settings_FlyoutTheme}"
                                     ItemTemplate="{StaticResource LocalizedEnumItemTemplate}"
                                     ItemsSource="{toolkit:EnumValues Type=ui:ElementTheme}"
                                     SelectedItem="{Binding UIManager.FlyoutTheme}" />
                    <ui:RadioButtons Header="{x:Static resx:Strings.Settings_AppTheme}"
                                     ItemTemplate="{StaticResource LocalizedEnumItemTemplate}"
                                     ItemsSource="{toolkit:EnumValues Type=ui:ElementTheme}"
                                     SelectedItem="{Binding UIManager.AppTheme}" />
                    <ui:RadioButtons Header="{x:Static resx:Strings.Settings_TopBarVisibility}"
                                     ItemTemplate="{StaticResource LocalizedEnumItemTemplate}"
                                     ItemsSource="{toolkit:EnumValues Type=localui:TopBarVisibility}"
                                     SelectedItem="{Binding UIManager.TopBarVisibility}" />
                    <ui:SimpleStackPanel Spacing="10" HorizontalAlignment="Left" Orientation="Horizontal">
                        <Slider ui:ControlHelper.Header="{x:Static resx:Strings.Settings_FlyoutBackgroundOpacity}"
                                Minimum="0" Maximum="100" HorizontalAlignment="Left"
                                AutoToolTipPlacement="TopLeft" Width="240"
                                IsMoveToPointEnabled="True" Value="{Binding UIManager.FlyoutBackgroundOpacity}" />
                        <TextBlock Style="{DynamicResource BaseTextBlockStyle}"
                                   VerticalAlignment="Center" Margin="0,22,0,0">
                            <Run Text="{Binding Path=UIManager.FlyoutBackgroundOpacity, StringFormat={}{0:#0}%}" />
                        </TextBlock>
                    </ui:SimpleStackPanel>
                    <ui:ToggleSwitch Header="{x:Static resx:Strings.Settings_TrayIconEnabled}"
                                     IsOn="{Binding UIManager.TrayIconEnabled}"
                                     OnContent="{x:Static resx:Strings.Settings_On}"
                                     OffContent="{x:Static resx:Strings.Settings_Off}" />
                    <ui:ToggleSwitch Header="{x:Static resx:Strings.Settings_UseColoredTrayIcon}"
                                     IsOn="{Binding UIManager.UseColoredTrayIcon}"
                                     OnContent="{x:Static resx:Strings.Settings_On}"
                                     OffContent="{x:Static resx:Strings.Settings_Off}"
                                     Visibility="{Binding UIManager.TrayIconEnabled,
                                        Converter={StaticResource BooleanToVisibilityConverter}}" />
                    <ui:ToggleSwitch Header="{x:Static resx:Strings.Settings_FlyoutAnimationEnabled}"
                                     IsOn="{Binding UIManager.FlyoutAnimationEnabled}"
                                     OnContent="{x:Static resx:Strings.Settings_On}"
                                     OffContent="{x:Static resx:Strings.Settings_Off}" />
                </ui:SimpleStackPanel>
            </GroupBox>

            <GroupBox Header="{x:Static resx:Strings.Settings_Behavior}">
                <ui:SimpleStackPanel Spacing="10">
                    <ui:NumberBox Header="{x:Static resx:Strings.Settings_FlyoutTimeout}"
                                  HorizontalAlignment="Left" Minimum="100"
                                  SmallChange="50" LargeChange="100" MinWidth="240"
                                  SpinButtonPlacementMode="Inline" Value="{Binding UIManager.FlyoutTimeout}">
                        <ui:NumberBox.Description>
                            <ui:SimpleStackPanel Margin="0,5,0,0" Orientation="Horizontal" Spacing="5">
                                <Viewbox Height="16">
                                    <Border>
                                        <ui:SymbolIcon Symbol="SolidStar" />
                                    </Border>
                                </Viewbox>
                                <TextBlock Text="{x:Static helpers:DefaultValuesStore.RecommendedFlyoutTimeout}" />
                            </ui:SimpleStackPanel>
                        </ui:NumberBox.Description>
                    </ui:NumberBox>
                </ui:SimpleStackPanel>
            </GroupBox>
        </StackPanel>
    </controls:ScrollViewerEx>
</Page>
