<!-- 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.RatingControlPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:MUXControlsTestApp"
    xmlns:muxcontrols="http://schemas.modernwpf.com/2019"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <StackPanel
        Orientation="Vertical"
        VerticalAlignment="Center"
        HorizontalAlignment="Center"
        Background="{DynamicResource SystemControlPageBackgroundAltHighBrush}">
        <!-- this guy is out of the Scroller because it's where I do panning tests: [and having nested pannable things is NOT WHAT SHOULD BE DONE!] -->
        <muxcontrols:RatingControl
            x:Name="TestRatingControl"
            AutomationProperties.Name="TestRatingControl"
            Loaded="TestRatingControl_Loaded"
            PlaceholderValue="2.5" />
        <ScrollViewer
            Height="500"
            Grid.Column="0">
            <StackPanel
                x:Name="mainStackPanel"
                HorizontalAlignment="Center"
                VerticalAlignment="Center">
                <TextBlock
                    Text="Test Not Started"
                    x:Name="TestTextBlockControl"
                    AutomationProperties.Name="TestTextBlockControl" />
                <Button
                    Click="TestRatingControlButton_Click"
                    Content="Set Placeholder to null"
                    AutomationProperties.Name="PHButton" />
                <TextBlock
                    Text="Scale not propagated"
                    x:Name="ScaleTextX"
                    AutomationProperties.AutomationId="ScaleTextXBlock" />
                <TextBlock
                    Text="Scale not propagated"
                    x:Name="ScaleTextY"
                    AutomationProperties.AutomationId="ScaleTextYBlock" />
                <TextBlock
                    x:Name="FrameDetails"
                    AutomationProperties.AutomationId="FrameDetails"
                    Text="NotReady" />
                <muxcontrols:RatingControl
                    x:Name="MyRatingReadOnly"
                    IsReadOnly="true"
                    Caption="ReadOnly"
                    AutomationProperties.Name="MyRatingReadOnly"
                    Value="2.2" />
                <muxcontrols:RatingControl
                    x:Name="MyRatingReadOnlyWithValue"
                    IsReadOnly="true"
                    Caption="ReadOnly with Value"
                    AutomationProperties.Name="MyRatingReadOnlyWithValue"
                    ValueChanged="MyRatingReadOnly_ValueChanged" />
                <TextBlock
                    Text="Test Not Started"
                    x:Name="MyRatingReadOnlyTextBlock"
                    AutomationProperties.Name="MyRatingReadOnlyTextBlock" />
                <muxcontrols:RatingControl
                    x:Name="MyRatingReadOnlyWithPlaceholder"
                    IsReadOnly="true"
                    Caption="ReadOnly with Placeholder"
                    AutomationProperties.Name="MyRatingReadOnlyWithPlaceholder" />
                <muxcontrols:RatingControl
                    x:Name="MyRatingIsClearEnabled"
                    IsClearEnabled="false"
                    Caption="Unclearable"
                    ValueChanged="MyRatingIsClearEnabled_ValueChanged"
                    AutomationProperties.Name="MyRatingIsClearEnabled" />
                <TextBlock
                    Text="Test Not Started [2]"
                    x:Name="MyRatingIsClearEnabledText"
                    AutomationProperties.Name="MyRatingIsClearEnabledText" />
                <muxcontrols:RatingControl
                    x:Name="MyRatingInitialSetValue"
                    InitialSetValue="3"
                    Caption="InitialSetValue: 3" />
                <muxcontrols:RatingControl
                    x:Name="SpecText"
                    Caption="Your rating" />
                <muxcontrols:RatingControl
                    x:Name="SpecNumbers"
                    Caption="(3856)" />

                <muxcontrols:RatingControl
                    x:Name="RatingBindingSample"
                    Caption="{Binding Path=Text, Mode=OneWay}"
                    AutomationProperties.Name="RatingBindingSample" />
                <TextBlock
                    Text="Test Not Started"
                    x:Name="RatingBindingSampleText"
                    AutomationProperties.AutomationId="RatingBindingSampleText" />
                <Button
                    Click="RatingBindingSampleButton_Click"
                    Content="Make ^ textblock be the ^^ rating's caption"
                    AutomationProperties.Name="RatingBindingSampleButton" />

                <muxcontrols:RatingControl
                    x:Name="RatingXBindSample"
                    Caption="{Binding Text, ElementName=CaptionStringBox, Mode=OneWay}"
                    AutomationProperties.Name="RatingXBindSample" />
                <TextBlock
                    Text="Test Not Started"
                    x:Name="RatingXBindSampleText"
                    AutomationProperties.Name="RatingXBindSampleText" />
                <Button
                    Click="RatingXBindSampleButton_Click"
                    Content="Make ^ textblock be the ^^ rating's caption"
                    AutomationProperties.Name="RatingXBindSampleButton" />

                <muxcontrols:RatingControl
                    x:Name="BindingRatingCaption"
                    MaxRating="1"
                    Caption="This rating control is to test {Binding} to non-RC DPs"
                    Foreground="{Binding Foreground}" />
                <muxcontrols:RatingControl
                    MaxRating="1"
                    Caption="This rating control is to test {Binding} to non-RC DPs"
                    Foreground="{Binding Foreground, ElementName=ColorFlipButton, Mode=OneWay}" />

                <Button
                    x:Name="ColorFlipButton"
                    Content="Flip the bound caption colors"
                    Click="ColorFlipButton_Click" />

                <TextBox
                    x:Name="CaptionStringBox"
                    Text="Binding successful" />

                <Slider
                    Maximum="5"
                    x:Name="Slider1" />
                <muxcontrols:RatingControl Value="{Binding Slider1.Value}" />
                <muxcontrols:RatingControl Value="{Binding Value, ElementName=Slider1, Mode=OneWay}" />

                <muxcontrols:RatingControl
                    x:Name="ValueChangeInMarkup"
                    IsClearEnabled="false"
                    Caption="Unclearable"
                    ValueChanged="ValueChangeInMarkup_ValueChanged"
                    AutomationProperties.Name="ValueChangeInMarkup" />
                <TextBlock
                    Text="Test Not Started [3]"
                    x:Name="ValueChangeInMarkupText"
                    AutomationProperties.Name="ValueChangeInMarkupText" />

                <muxcontrols:RatingControl
                    FontFamily="Times New Roman"
                    Caption="this rating should be squares" />

                <muxcontrols:RatingControl x:Name="MakeMeSquares" />
                <Button
                    x:Name="MakeTheAboveRatingSquares"
                    Click="MakeTheAboveRatingSquares_Click"
                    Content="Make the above RC squares" />

                <muxcontrols:RatingControl x:Name="CustomGlyphs">
                    <muxcontrols:RatingControl.ItemInfo>
                        <muxcontrols:RatingItemFontInfo
                            Glyph="&#xE899;"
                            UnsetGlyph="&#xE899;"
                            PointerOverGlyph="&#xE899;"
                            PointerOverPlaceholderGlyph="&#xE899;"
                            DisabledGlyph="&#xE899;" />
                    </muxcontrols:RatingControl.ItemInfo>
                </muxcontrols:RatingControl>

                <muxcontrols:RatingControl
                    x:Name="CustomImages"
                    Caption="CustomImages1"
                    Loaded="CustomImages_Loaded"
                    AutomationProperties.AutomationId="CustomImages">
                    <muxcontrols:RatingControl.ItemInfo>
                        <muxcontrols:RatingItemImageInfo
                            Image="/Assets/rating_set.png"
                            UnsetImage="/Assets/rating_unset.png"
                            PlaceholderImage="/Assets/rating_placeholder.png"
                            DisabledImage="/Assets/rating_disabled.png"
                            PointerOverImage="/Assets/rating_mouseoverset.png"
                            PointerOverPlaceholderImage="/Assets/rating_mouseoverplaceholder.png" />
                    </muxcontrols:RatingControl.ItemInfo>
                </muxcontrols:RatingControl>

                <CheckBox
                    AutomationProperties.AutomationId="CustomImagesLoadedCheckBox"
                    x:Name="CustomImagesLoadedCheckBox"
                    IsChecked="False"
                    Content="CustomImages loaded" />

                <muxcontrols:RatingControl
                    x:Name="CustomImagesTwo"
                    Caption="CustomImages2"
                    AutomationProperties.AutomationId="CustomImagesTwo"
                    Loaded="CustomImagesTwo_Loaded" />
                <Button
                    x:Name="ChangeCustomImagesTwoType"
                    AutomationProperties.AutomationId="ChangeCustomImagesTwoType"
                    Content="ChangeType"
                    Click="ChangeCustomImagesTwoType_Click" />

                <CheckBox
                    AutomationProperties.AutomationId="StageOneCheckbox"
                    x:Name="CustomImagesTwoLoadedStageOneCheckBox"
                    IsChecked="False"
                    Content="Stage1 done" />
                <CheckBox
                    AutomationProperties.AutomationId="StageTwoCheckbox"
                    x:Name="CustomImagesTwoLoadedStageTwoCheckBox"
                    IsChecked="False"
                    Content="Stage2 done" />
                <CheckBox
                    AutomationProperties.AutomationId="StageThreeCheckbox"
                    x:Name="CustomImagesTwoLoadedStageThreeCheckBox"
                    IsChecked="False"
                    Content="Stage3 done" />

                <muxcontrols:RatingControl
                    x:Name="ValuePatternRoundTest1"
                    AutomationProperties.AutomationId="ValuePatternRoundTest1"
                    Value="1.50" />
                <muxcontrols:RatingControl
                    x:Name="ValuePatternRoundTest2"
                    AutomationProperties.AutomationId="ValuePatternRoundTest2"
                    Value="1.55" />
                <muxcontrols:RatingControl
                    x:Name="ValuePatternRoundTest3"
                    AutomationProperties.AutomationId="ValuePatternRoundTest3"
                    Value="1.501" />

                <muxcontrols:RatingControl
                    x:Name="MagicDisengager"
                    AutomationProperties.AutomationId="MagicDisengager"
                    Caption="Resets at 3"
                    ValueChanged="MagicDisengager_ValueChanged" />
                <TextBlock
                    x:Name="MagicDisengagerTextBlock"
                    AutomationProperties.AutomationId="MagicDisengagerTextBlock" />


                <Grid
                    Background="Black"
                    Height="48">
                    <muxcontrols:RatingControl
                        x:Name="RatingDarkTheme"
                        muxcontrols:ThemeManager.RequestedTheme="Dark"
                        Caption="What" />
                </Grid>
                <Button
                    Click="Button_Click"
                    Content="Right to Left"
                    AutomationProperties.Name="RTLButton" />
                <muxcontrols:RatingControl
                    x:Name="CapitalAscenders"
                    Caption="á à Â Á" />
                <muxcontrols:RatingControl
                    x:Name="Capitals"
                    Caption="A B C D" />
                <muxcontrols:RatingControl
                    x:Name="Descenders"
                    Caption="j y" />
                <muxcontrols:RatingControl
                    x:Name="Max"
                    Caption="j y á à Â Á" />
                <muxcontrols:RatingControl
                    x:Name="lowercase"
                    Caption="a b c d e" />
                <muxcontrols:RatingControl
                    x:Name="lowercaseAscenders"
                    Caption="á à" />
                <TextBlock Text="--- there's a collapsed rating control below here ---" />
                <muxcontrols:RatingControl
                    x:Name="CollapsedRatingControl"
                    AutomationProperties.Name="CollapsedRatingControl"
                    Visibility="Collapsed" />
                <Button
                    Click="CollapsedRatingControlButton_Click"
                    AutomationProperties.Name="CollapsedRatingControlButton"
                    Content="Set Rating of invisible control above" />

                <muxcontrols:RatingControl
                    x:Name="MaxRating6Unset"
                    MaxRating="6" />
                <muxcontrols:RatingControl
                    x:Name="MaxRating9Unset"
                    MaxRating="9"
                    AutomationProperties.Name="MaxRating9Unset"
                    ValueChanged="MaxRating9Unset_ValueChanged" />
                <TextBlock
                    Text="Test Not Started [MR9]"
                    x:Name="MaxRating9UnsetTextBlock"
                    AutomationProperties.Name="MaxRating9UnsetTextBlock" />
                <muxcontrols:RatingControl
                    x:Name="MaxRating6Set"
                    MaxRating="6" />
                <muxcontrols:RatingControl
                    x:Name="MaxRating9Set"
                    MaxRating="9" />

                <muxcontrols:RatingControl
                    x:Name="MaxRating6UnsetWCaption"
                    Caption="Caption"
                    MaxRating="6" />
                <muxcontrols:RatingControl
                    x:Name="MaxRating9UnsetWCaption"
                    Caption="Caption"
                    MaxRating="9" />
                <muxcontrols:RatingControl
                    x:Name="MaxRating6SetWCaption"
                    Caption="Caption"
                    MaxRating="6" />
                <muxcontrols:RatingControl
                    x:Name="MaxRating9SetWCaption"
                    Caption="Caption"
                    MaxRating="9" />

                <muxcontrols:RatingControl
                    x:Name="DisabledWithValue"
                    Caption="Disabled with alue"
                    IsEnabled="False" />
                <muxcontrols:RatingControl
                    x:Name="DisabledWithPlaceholderValue"
                    Caption="Disabled with placeholder value"
                    IsEnabled="False" />
                <muxcontrols:RatingControl
                    IsEnabled="False"
                    Caption="Disabled" />

                <StackPanel Orientation="Vertical">
                    <StackPanel.Resources>
                        <Style BasedOn="{StaticResource BodyTextBlockStyle}" TargetType="TextBlock">
                            <Setter Property="FontFamily" Value="Times New Roman" />
                        </Style>
                    </StackPanel.Resources>
                    <muxcontrols:RatingControl
                        x:Name="PlzDontBeSquares"
                        Caption="These shouldn't be squares" />
                </StackPanel>

                <StackPanel Orientation="Horizontal">
                    <muxcontrols:RatingControl
                        x:Name="UnsetFallbackRating"
                        MaxRating="1"
                        Loaded="UnsetFallbackRating_Loaded"
                        AutomationProperties.AutomationId="UnsetFallbackRating">
                        <muxcontrols:RatingControl.Resources>
                            <ResourceDictionary>
                                <SolidColorBrush x:Key="RatingControlBackground" Color="Red" />
                            </ResourceDictionary>
                        </muxcontrols:RatingControl.Resources>
                        <muxcontrols:RatingControl.ItemInfo>
                            <muxcontrols:RatingItemFontInfo Glyph="&#xE00B;" />
                        </muxcontrols:RatingControl.ItemInfo>
                    </muxcontrols:RatingControl>
                    <TextBlock
                        x:Name="UnsetFallbackTextBlock"
                        Text="^"
                        AutomationProperties.AutomationId="UnsetFallbackTextBlock" />

                    <muxcontrols:RatingControl
                        x:Name="PlaceholderFallbackRating"
                        MaxRating="1"
                        PlaceholderValue="0.5"
                        Loaded="PlaceholderFallbackRating_Loaded"
                        AutomationProperties.AutomationId="PlaceholderFallbackRating">
                        <muxcontrols:RatingControl.ItemInfo>
                            <muxcontrols:RatingItemFontInfo Glyph="&#xE909;" />
                        </muxcontrols:RatingControl.ItemInfo>
                    </muxcontrols:RatingControl>
                    <TextBlock
                        x:Name="PlaceholderFallbackTextBlock"
                        Text="^"
                        AutomationProperties.AutomationId="" />

                    <muxcontrols:RatingControl
                        x:Name="DisabledFallbackRating"
                        IsEnabled="false"
                        MaxRating="1"
                        Loaded="DisabledFallbackRating_Loaded"
                        AutomationProperties.AutomationId="">
                        <muxcontrols:RatingControl.ItemInfo>
                            <muxcontrols:RatingItemFontInfo Glyph="&#xE8DD;" />
                        </muxcontrols:RatingControl.ItemInfo>
                    </muxcontrols:RatingControl>
                    <TextBlock
                        x:Name="DisabledFallbackTextBlock"
                        Text="^"
                        AutomationProperties.AutomationId="DisabledFallbackTextBlock" />

                    <muxcontrols:RatingControl
                        x:Name="PointerOverPlaceholderFallbackRating"
                        MaxRating="1"
                        PlaceholderValue="0.5"
                        AutomationProperties.AutomationId="PointerOverPlaceholderFallbackRating">
                        <muxcontrols:RatingControl.ItemInfo>
                            <muxcontrols:RatingItemFontInfo
                                PlaceholderGlyph="&#xEBAA;"
                                Glyph="&#xE730;" />
                        </muxcontrols:RatingControl.ItemInfo>
                    </muxcontrols:RatingControl>
                    <TextBlock
                        x:Name="PointerOverPlaceholderFallbackTextBlock"
                        Text="^"
                        AutomationProperties.AutomationId="PointerOverPlaceholderFallbackTextBlock" />

                    <muxcontrols:RatingControl
                        x:Name="PointerOverFallbackRating"
                        MaxRating="1"
                        AutomationProperties.AutomationId="PointerOverFallbackRating">
                        <muxcontrols:RatingControl.ItemInfo>
                            <muxcontrols:RatingItemFontInfo Glyph="&#xE8CA;" />
                        </muxcontrols:RatingControl.ItemInfo>
                    </muxcontrols:RatingControl>
                    <TextBlock
                        x:Name="PointerOverFallbackTextBlock"
                        Text="^"
                        AutomationProperties.AutomationId="PointerOverFallbackTextBlock" />

                    <muxcontrols:RatingControl
                        x:Name="NoFallbackRating"
                        MaxRating="1"
                        AutomationProperties.AutomationId="NoFallbackRating"
                        Loaded="NoFallbackRating_Loaded">
                        <muxcontrols:RatingControl.ItemInfo>
                            <muxcontrols:RatingItemFontInfo DisabledGlyph="&#xE8CA;" />
                        </muxcontrols:RatingControl.ItemInfo>
                    </muxcontrols:RatingControl>
                    <TextBlock
                        x:Name="NoFallbackTextBlock"
                        Text="^"
                        AutomationProperties.AutomationId="NoFallbackTextBlock" />
                </StackPanel>

                <StackPanel Orientation="Horizontal">
                    <muxcontrols:RatingControl
                        x:Name="UnsetImageFallbackRating"
                        MaxRating="1"
                        Loaded="UnsetImageFallbackRating_Loaded"
                        AutomationProperties.AutomationId="UnsetImageFallbackRating">
                        <muxcontrols:RatingControl.ItemInfo>
                            <muxcontrols:RatingItemImageInfo Image="/Assets/rating_set.png" />
                        </muxcontrols:RatingControl.ItemInfo>
                    </muxcontrols:RatingControl>
                    <TextBlock
                        x:Name="UnsetImageFallbackTextBlock"
                        Text="^"
                        AutomationProperties.AutomationId="UnsetImageFallbackTextBlock" />

                    <muxcontrols:RatingControl
                        x:Name="PlaceholderImageFallbackRating"
                        MaxRating="1"
                        PlaceholderValue="0.5"
                        Loaded="PlaceholderImageFallbackRating_Loaded"
                        AutomationProperties.AutomationId="PlaceholderImageFallbackRating">
                        <muxcontrols:RatingControl.ItemInfo>
                            <muxcontrols:RatingItemImageInfo Image="/Assets/rating_unset.png" />
                        </muxcontrols:RatingControl.ItemInfo>
                    </muxcontrols:RatingControl>
                    <TextBlock
                        x:Name="PlaceholderImageFallbackTextBlock"
                        Text="^"
                        AutomationProperties.AutomationId="" />

                    <muxcontrols:RatingControl
                        x:Name="DisabledImageFallbackRating"
                        IsEnabled="false"
                        MaxRating="1"
                        Loaded="DisabledImageFallbackRating_Loaded"
                        AutomationProperties.AutomationId="">
                        <muxcontrols:RatingControl.ItemInfo>
                            <muxcontrols:RatingItemImageInfo Image="/Assets/rating_placeholder.png" />
                        </muxcontrols:RatingControl.ItemInfo>
                    </muxcontrols:RatingControl>
                    <TextBlock
                        x:Name="DisabledImageFallbackTextBlock"
                        Text="^"
                        AutomationProperties.AutomationId="DisabledImageFallbackTextBlock" />

                    <muxcontrols:RatingControl
                        x:Name="PointerOverPlaceholderImageFallbackRating"
                        MaxRating="1"
                        PlaceholderValue="0.5"
                        AutomationProperties.AutomationId="PointerOverPlaceholderImageFallbackRating">
                        <muxcontrols:RatingControl.ItemInfo>
                            <muxcontrols:RatingItemImageInfo
                                PlaceholderImage="/Assets/rating_disabled.png"
                                Image="/Assets/rating_mouseoverset.png" />
                        </muxcontrols:RatingControl.ItemInfo>
                    </muxcontrols:RatingControl>
                    <TextBlock
                        x:Name="PointerOverPlaceholderImageFallbackTextBlock"
                        Text="^"
                        AutomationProperties.AutomationId="PointerOverPlaceholderImageFallbackTextBlock" />

                    <muxcontrols:RatingControl
                        x:Name="PointerOverImageFallbackRating"
                        MaxRating="1"
                        AutomationProperties.AutomationId="PointerOverImageFallbackRating">
                        <muxcontrols:RatingControl.ItemInfo>
                            <muxcontrols:RatingItemImageInfo Image="/Assets/rating_mouseoverplaceholder.png" />
                        </muxcontrols:RatingControl.ItemInfo>
                    </muxcontrols:RatingControl>
                    <TextBlock
                        x:Name="PointerOverImageFallbackTextBlock"
                        Text="^"
                        AutomationProperties.AutomationId="PointerOverImageFallbackTextBlock" />
                </StackPanel>
            </StackPanel>
        </ScrollViewer>
    </StackPanel>
</local:TestPage>
