<ui:Page
    x:Class="ModernWpf.SampleApp.ControlPages.SliderPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ui="http://schemas.modernwpf.com/2019"
    xmlns:sc="clr-namespace:SamplesCommon;assembly=SamplesCommon"
    mc:Ignorable="d">

    <Page.Resources>
        <Style TargetType="Slider" BasedOn="{StaticResource DefaultSliderStyle}">
            <Setter Property="Maximum" Value="100" />
            <Setter Property="TickFrequency" Value="1" />
            <Setter Property="IsSnapToTickEnabled" Value="True" />
            <Setter Property="AutoToolTipPlacement" Value="TopLeft" />
        </Style>
    </Page.Resources>

    <ScrollViewer>
        <ui:SimpleStackPanel Style="{StaticResource ControlPageContentPanelStyle}">
            <sc:ControlExample
                x:Name="Example1"
                HeaderText="A simple Slider.">
                <StackPanel Orientation="Horizontal">
                    <Slider
                        x:Name="Slider1"
                        AutomationProperties.Name="simple slider"
                        Width="200" />
                    <TextBlock
                        Style="{StaticResource OutputTextBlockStyle}"
                        Text="{Binding Value, ElementName=Slider1}" />
                </StackPanel>
            </sc:ControlExample>
            <sc:ControlExample
                x:Name="Example2"
                HeaderText="A Slider with range and steps specified.">
                <StackPanel
                    x:Name="Control2"
                    Orientation="Horizontal">
                    <Slider
                        x:Name="Slider2"
                        ui:ControlHelper.Header="Control header"
                        Width="200"
                        Minimum="500"
                        Maximum="1000"
                        LargeChange="100"
                        SmallChange="10"
                        TickFrequency="10"
                        Value="800" />
                    <TextBlock
                        Style="{StaticResource OutputTextBlockStyle}"
                        Text="{Binding Value, ElementName=Slider2, Mode=OneWay}" />
                </StackPanel>
            </sc:ControlExample>
            <sc:ControlExample
                x:Name="Example3"
                HeaderText="A Slider with tick marks.">
                <StackPanel Orientation="Horizontal">
                    <Slider
                        x:Name="Slider3"
                        Width="290"
                        TickFrequency="10"
                        TickPlacement="Both"
                        AutomationProperties.Name="Slider with ticks" />
                    <TextBlock
                        Style="{StaticResource OutputTextBlockStyle}"
                        Text="{Binding Value, ElementName=Slider3, Mode=OneWay}" />
                </StackPanel>
            </sc:ControlExample>
            <sc:ControlExample
                x:Name="Example4"
                HeaderText="A vertical slider with range and tick marks specified.">
                <StackPanel Orientation="Horizontal">
                    <Slider
                        x:Name="Slider4"
                        Width="100"
                        Height="100"
                        Orientation="Vertical"
                        TickFrequency="10"
                        TickPlacement="Both"
                        Maximum="50"
                        Minimum="-50"
                        AutomationProperties.Name="vertical slider" />
                    <TextBlock
                        Style="{StaticResource OutputTextBlockStyle}"
                        Text="{Binding Value, ElementName=Slider4, Mode=OneWay}" />
                </StackPanel>
            </sc:ControlExample>
            <sc:ControlExample
                HeaderText="API in action"
                HorizontalContentAlignment="Stretch"
                VerticalContentAlignment="Stretch">
                <Grid>
                    <Slider
                        x:Name="slider"
                        Maximum="100"
                        IsMoveToPointEnabled="True"
                        AutoToolTipPlacement="TopLeft"
                        TickFrequency="10"
                        TickPlacement="Both"
                        ui:ControlHelper.Header="Control header">
                        <Slider.Style>
                            <Style TargetType="Slider" BasedOn="{StaticResource DefaultSliderStyle}">
                                <Style.Triggers>
                                    <Trigger Property="Orientation" Value="Horizontal">
                                        <Setter Property="VerticalAlignment" Value="Top" />
                                    </Trigger>
                                    <Trigger Property="Orientation" Value="Vertical">
                                        <Setter Property="HorizontalAlignment" Value="Left" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Slider.Style>
                    </Slider>
                </Grid>

                <sc:ControlExample.Options>
                    <ui:SimpleStackPanel Style="{StaticResource OptionsPanelStyle}">
                        <CheckBox
                            Content="IsSnapToTickEnabled"
                            IsChecked="{Binding ElementName=slider, Path=IsSnapToTickEnabled}" />
                        <CheckBox
                            Content="IsSelectionRangeEnabled"
                            IsEnabled="False"
                            IsChecked="{Binding ElementName=slider, Path=IsSelectionRangeEnabled}" />
                        <CheckBox
                            Content="IsDirectionReversed"
                            IsChecked="{Binding ElementName=slider, Path=IsDirectionReversed}" />
                        <CheckBox
                            Content="IsMoveToPointEnabled"
                            IsChecked="{Binding ElementName=slider, Path=IsMoveToPointEnabled}" />
                        <ui:RadioButtons
                            Header="AutoToolTipPlacement"
                            ItemsSource="{Binding Source={x:Type AutoToolTipPlacement}, Converter={StaticResource EnumValuesConverter}}"
                            SelectedItem="{Binding ElementName=slider, Path=AutoToolTipPlacement}" />
                        <ui:RadioButtons
                            Header="TickPlacement"
                            ItemsSource="{Binding Source={x:Type TickPlacement}, Converter={StaticResource EnumValuesConverter}}"
                            SelectedItem="{Binding ElementName=slider, Path=TickPlacement}" />
                        <ui:RadioButtons
                            Header="Orientation"
                            ItemsSource="{Binding Source={x:Type Orientation}, Converter={StaticResource EnumValuesConverter}}"
                            SelectedItem="{Binding ElementName=slider, Path=Orientation}" />
                    </ui:SimpleStackPanel>
                </sc:ControlExample.Options>
            </sc:ControlExample>
        </ui:SimpleStackPanel>
    </ScrollViewer>
</ui:Page>
