<local:NavigablePage
    x:Class="Microsoft.PowerToys.Settings.UI.Views.MeasureToolPage"
    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:tkcontrols="using:CommunityToolkit.WinUI.Controls"
    xmlns:ui="using:CommunityToolkit.WinUI"
    AutomationProperties.LandmarkType="Main"
    mc:Ignorable="d">

    <controls:SettingsPageControl x:Uid="MeasureTool" ModuleImageSource="ms-appx:///Assets/Settings/Modules/ScreenRuler.png">
        <controls:SettingsPageControl.ModuleContent>
            <StackPanel ChildrenTransitions="{StaticResource SettingsCardsAnimations}" Orientation="Vertical">
                <controls:GPOInfoControl ShowWarning="{x:Bind ViewModel.IsEnabledGpoConfigured, Mode=OneWay}">
                    <tkcontrols:SettingsCard
                        Name="MeasureToolEnableMeasureTool"
                        x:Uid="MeasureTool_EnableMeasureTool"
                        HeaderIcon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ScreenRuler.png}">
                        <ToggleSwitch
                            x:Uid="ToggleSwitch"
                            AutomationProperties.AutomationId="Toggle_ScreenRuler"
                            IsOn="{x:Bind ViewModel.IsEnabled, Mode=TwoWay}" />
                    </tkcontrols:SettingsCard>
                </controls:GPOInfoControl>

                <controls:SettingsGroup x:Uid="MeasureTool_ActivationSettings" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
                    <tkcontrols:SettingsCard
                        Name="MeasureToolActivationShortcut"
                        x:Uid="MeasureTool_ActivationShortcut"
                        HeaderIcon="{ui:FontIcon Glyph=&#xEDA7;}">
                        <controls:ShortcutControl
                            MinWidth="{StaticResource SettingActionControlMinWidth}"
                            AutomationProperties.AutomationId="Shortcut_ScreenRuler"
                            HotkeySettings="{x:Bind Path=ViewModel.ActivationShortcut, Mode=TwoWay}" />
                    </tkcontrols:SettingsCard>
                    <tkcontrols:SettingsCard Name="MeasureToolDefaultMeasureStyle" x:Uid="MeasureTool_DefaultMeasureStyle">
                        <ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Path=ViewModel.DefaultMeasureStyle, Mode=TwoWay}">
                            <ComboBoxItem x:Uid="MeasureTool_DefaultMeasureStyle_None" />
                            <ComboBoxItem x:Uid="MeasureTool_DefaultMeasureStyle_Bounds" />
                            <ComboBoxItem x:Uid="MeasureTool_DefaultMeasureStyle_Spacing" />
                            <ComboBoxItem x:Uid="MeasureTool_DefaultMeasureStyle_Horizontal_Spacing" />
                            <ComboBoxItem x:Uid="MeasureTool_DefaultMeasureStyle_Vertical_Spacing" />
                        </ComboBox>
                    </tkcontrols:SettingsCard>

                </controls:SettingsGroup>

                <controls:SettingsGroup x:Uid="MeasureTool_Settings" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
                    <tkcontrols:SettingsCard
                        Name="MeasureToolContinuousCapture"
                        x:Uid="MeasureTool_ContinuousCapture"
                        HeaderIcon="{ui:FontIcon Glyph=&#xE7FB;}">
                        <ToggleSwitch x:Uid="MeasureTool_ContinuousCapture_ToggleSwitch" IsOn="{x:Bind ViewModel.ContinuousCapture, Mode=TwoWay}" />
                    </tkcontrols:SettingsCard>
                    <InfoBar
                        x:Uid="MeasureTool_ContinuousCapture_Information"
                        IsClosable="False"
                        IsOpen="{x:Bind ViewModel.ShowContinuousCaptureWarning, Mode=OneWay}"
                        IsTabStop="{x:Bind ViewModel.ShowContinuousCaptureWarning, Mode=OneWay}"
                        Severity="Warning" />

                    <tkcontrols:SettingsCard
                        Name="MeasureToolPerColorChannelEdgeDetection"
                        x:Uid="MeasureTool_PerColorChannelEdgeDetection"
                        HeaderIcon="{ui:FontIcon Glyph=&#xE7FB;}">
                        <ToggleSwitch x:Uid="MeasureTool_PerColorChannelEdgeDetection_ToggleSwitch" IsOn="{x:Bind ViewModel.PerColorChannelEdgeDetection, Mode=TwoWay}" />
                    </tkcontrols:SettingsCard>

                    <tkcontrols:SettingsCard Name="MeasureToolPixelTolerance" x:Uid="MeasureTool_PixelTolerance">
                        <Slider
                            MinWidth="{StaticResource SettingActionControlMinWidth}"
                            Maximum="255"
                            Minimum="0"
                            Value="{x:Bind ViewModel.PixelTolerance, Mode=TwoWay}" />
                    </tkcontrols:SettingsCard>

                    <tkcontrols:SettingsCard
                        Name="MeasureToolUnitsOfMeasure"
                        x:Uid="MeasureTool_UnitsOfMeasure"
                        HeaderIcon="{ui:FontIcon Glyph=&#xECC6;}">
                        <ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Path=ViewModel.UnitsOfMeasure, Mode=TwoWay}">
                            <ComboBoxItem x:Uid="MeasureTool_UnitsOfMeasure_Pixels" />
                            <ComboBoxItem x:Uid="MeasureTool_UnitsOfMeasure_Inches" />
                            <ComboBoxItem x:Uid="MeasureTool_UnitsOfMeasure_Centimeters" />
                            <ComboBoxItem x:Uid="MeasureTool_UnitsOfMeasure_Millimeters" />
                        </ComboBox>
                    </tkcontrols:SettingsCard>

                    <tkcontrols:SettingsCard Name="MeasureToolDrawFeetOnCross" x:Uid="MeasureTool_DrawFeetOnCross">
                        <ToggleSwitch x:Uid="MeasureTool_DrawFeetOnCross_ToggleSwitch" IsOn="{x:Bind ViewModel.DrawFeetOnCross, Mode=TwoWay}" />
                    </tkcontrols:SettingsCard>

                    <tkcontrols:SettingsCard Name="MeasureToolMeasureCrossColor" x:Uid="MeasureTool_MeasureCrossColor">
                        <controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.CrossColor, Mode=TwoWay}" />
                    </tkcontrols:SettingsCard>
                </controls:SettingsGroup>
            </StackPanel>
        </controls:SettingsPageControl.ModuleContent>
        <controls:SettingsPageControl.PrimaryLinks>
            <controls:PageLink x:Uid="LearnMore_MeasureTool" Link="https://aka.ms/PowerToysOverview_ScreenRuler" />
        </controls:SettingsPageControl.PrimaryLinks>
        <controls:SettingsPageControl.SecondaryLinks>
            <controls:PageLink x:Uid="Attribution_Rooler" Link="https://github.com/peteblois/rooler" />
        </controls:SettingsPageControl.SecondaryLinks>
    </controls:SettingsPageControl>
</local:NavigablePage>
