<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<local:TestPage
    x:Class="MUXControlsTestApp.ProgressBarPage"
    x:Name="ProgressBarTestPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:MUXControlsTestApp"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:controls="http://schemas.modernwpf.com/2019"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.Resources>
        <local:NullableBooleanToBooleanConverter x:Key="NullableBooleanToBooleanConverter" />
    </Page.Resources>

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Margin="12">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <StackPanelEx Grid.ColumnSpan="3" Orientation="Horizontal" Spacing="8">
            <TextBlock Text="Sample Progressbar" Style="{ThemeResource StandardGroupHeader}"/>
            <controls:FontIcon Glyph="&#xF0AF;" Margin="4,0,40,3" FontSize="14" VerticalAlignment="Center"/>
            <ProgressBar
                x:Name="TestWUXProgressBar"
                Width="300"
                VerticalAlignment="Center"
                AutomationProperties.Name="TestWUXProgressBar"
                Style="{StaticResource DefaultProgressBarStyle}"
                HorizontalAlignment="Left"
                IsIndeterminate="{x:Bind ShowIsIndeterminateCheckBox.IsChecked, Converter={StaticResource NullableBooleanToBooleanConverter}, Mode=OneWay}"/>
            <controls:ProgressBar
                x:Name="TestProgressBar"
                Width="300"
                VerticalAlignment="Center"
                AutomationProperties.Name="TestProgressBar"
                HorizontalAlignment="Left"
                IsIndeterminate="{x:Bind ShowIsIndeterminateCheckBox.IsChecked, Converter={StaticResource NullableBooleanToBooleanConverter}, Mode=OneWay}"
                ShowPaused="{Binding IsChecked, ElementName=ShowPausedCheckBox, Mode=OneWay}"
                ShowError="{Binding IsChecked, ElementName=ShowErrorCheckBox, Mode=OneWay}"/>
        </StackPanelEx>

        <StackPanel Grid.Row="1">
            <StackPanelEx Style="{ThemeResource StandardGroupingStackPanel}">
                <TextBlock Text="Options" Style="{ThemeResource StandardGroupHeader}"/>
                <Grid Width="300" HorizontalAlignment="Left">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="1*" />
                        <ColumnDefinition Width="1*" />
                        <ColumnDefinition Width="1*" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <TextBoxEx x:Name="MaximumInput" AutomationProperties.Name="MaximumInput" Header="Maximum" PlaceholderText="100" Width="90" HorizontalAlignment="Left"/>
                    <TextBlock x:Name="MaximumInputText" AutomationProperties.Name="MaximumInputText" Grid.Column="1" Text="{Binding ElementName=TestProgressBar, Path=Maximum, Mode=TwoWay}"/>

                    <TextBoxEx x:Name="MinimumInput" AutomationProperties.Name="MinimumInput" Header="Minimum" PlaceholderText="0" Width="90" HorizontalAlignment="Left" Grid.Row="1"/>
                    <TextBlock x:Name="MinimumInputText" AutomationProperties.Name="MinimumInputText" Grid.Row="1" Grid.Column="1" Text="{Binding ElementName=TestProgressBar, Path=Minimum, Mode=TwoWay}"/>

                    <TextBoxEx x:Name="WidthInput" AutomationProperties.Name="WidthInput" Header="Width" PlaceholderText="0" Width="90" HorizontalAlignment="Left" Grid.Row="2"/>
                    <TextBlock x:Name="WidthInputText" AutomationProperties.Name="WidthInputText" Grid.Row="2" Grid.Column="1" Text="{Binding ElementName=TestProgressBar, Path=Width, Mode=TwoWay}"/>

                    <TextBoxEx x:Name="ValueInput" AutomationProperties.Name="ValueInput" Header="Value" PlaceholderText="0" Width="90" HorizontalAlignment="Left" Grid.Row="3"/>
                    <TextBlock x:Name="ValueText" AutomationProperties.Name="ValueText" Grid.Row="3" Grid.Column="1" Text="{Binding ElementName=TestProgressBar, Path=Value, Mode=TwoWay}"/>
                </Grid>

                <TextBlock Text="Padding" Margin="0, 20, 0, 10"/>

                <Grid Width="300" HorizontalAlignment="Left">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="1*" />
                        <ColumnDefinition Width="1*" />
                        <ColumnDefinition Width="1*" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <TextBoxEx x:Name="PaddingLeftInput" AutomationProperties.Name="PaddingLeftInput" Header="Left" PlaceholderText="0" Width="90" HorizontalAlignment="Left" Grid.Row="1"/>
                    <TextBlock x:Name="PaddingLeftText" AutomationProperties.Name="PaddingLeftText" Grid.Row="1" Grid.Column="1" Text="{Binding ElementName=TestProgressBar, Path=Padding.Left, Mode=TwoWay}"/>

                    <TextBoxEx x:Name="PaddingRightInput" AutomationProperties.Name="PaddingRightInput" Header="Right" PlaceholderText="0" Width="90" HorizontalAlignment="Left" Grid.Row="2"/>
                    <TextBlock x:Name="PaddingRightText" AutomationProperties.Name="PaddingRightText" Grid.Row="2" Grid.Column="1" Text="{Binding ElementName=TestProgressBar, Path=Padding.Right, Mode=TwoWay}"/>

                </Grid>
                <TextBlock Text="States"/>
                <CheckBox x:Name="ShowPausedCheckBox" AutomationProperties.Name="ShowPausedCheckBox" Content="ShowPaused" />
                <CheckBox x:Name="ShowErrorCheckBox" AutomationProperties.Name="ShowErrorCheckBox"  Content="ShowError"/>
                <CheckBox x:Name="ShowIsIndeterminateCheckBox" AutomationProperties.Name="ShowIsIndeterminateCheckBox" Content="IsIndeterminate"/>
            </StackPanelEx>
        </StackPanel>

        <StackPanelEx Style="{ThemeResource StandardGroupingStackPanel}" Grid.Row="1" Grid.Column="1" Margin="16,0,0,0">
            <TextBlock Text="Actions" Style="{ThemeResource StandardGroupHeader}"/>
            <Button x:Name="UpdateMinMaxButton" AutomationProperties.Name="UpdateMinMaxButton" Content="Update Min and Max" Click="UpdateMinMax_Click"/>
            <Button x:Name="UpdateWidthButton" AutomationProperties.Name="UpdateWidthButton" Content="Update Width" Click="UpdateWidth_Click"/>
            <Button x:Name="UpdateValueButton" AutomationProperties.Name="UpdateValueButton" Content="Update Value" Click="UpdateValue_Click"/>
            <RepeatButton x:Name="ChangeValueButton" AutomationProperties.Name="ChangeValueButton" Content="Hold and Change Value" Click="ChangeValue_Click" />
            <Button x:Name="UpdatePaddingButton" AutomationProperties.Name="UpdatePaddingButton" Content="Update Padding Left and Right" Click="UpdatePadding_Click"/>
        </StackPanelEx>

        <StackPanelEx Grid.Column="2" Grid.Row="1" Margin="16,0,0,0"
                      Style="{ThemeResource StandardGroupingStackPanel}">
            <TextBlock Text="Properties" Style="{ThemeResource StandardGroupHeader}"/>

            <TextBlock Text="Value" Margin="0, 20, 0, 0"/>
            <TextBlock x:Name="ROValueText" AutomationProperties.Name="ROValueText" Margin="0, 0, 0, 20"/>

            <TextBlock Text="Indicator Width" Margin="0, 20, 0, 0"/>
            <TextBlock x:Name="IndicatorWidthText" AutomationProperties.Name="IndicatorWidthText" Margin="0, 0, 0, 20"/>

            <TextBlock Text="Is paused:" Margin="0, 20, 0, 0" FontSize="20"/>
            <TextBlock AutomationProperties.Name="ShowPausedText" Text="{Binding IsChecked, ElementName=ShowPausedCheckBox, Mode=OneWay}"/>

            <TextBlock Text="Is error:" Margin="0, 20, 0, 0" FontSize="20"/>
            <TextBlock AutomationProperties.Name="ShowErrorText" Text="{Binding IsChecked, ElementName=ShowErrorCheckBox, Mode=OneWay}"/>

            <TextBlock Text="Is indeterminate:" Margin="0, 20, 0, 0" FontSize="20"/>
            <TextBlock AutomationProperties.Name="ShowIsIndeterminateText" Text="{x:Bind ShowIsIndeterminateCheckBox.IsChecked, Mode=OneWay}"/>

            <TextBlock x:Name="VisualStateText" AutomationProperties.Name="VisualStateText" Margin="0, 20, 0, 0" />
            <Button x:Name="NavigateToReTemplatePage" AutomationProperties.Name="NavigateToReTemplatePage">ProgressBar Re-Template Page</Button>
        </StackPanelEx>
    </Grid>
</local:TestPage>
