<!-- 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="RadioButtons_TestUI.RadioButtonsFocusPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:local="clr-namespace:MUXControlsTestApp"
    xmlns:controls="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"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>

        <!-- RadioButtons test group 1 -->
        <controls:RadioButtons x:Name="TestRadioButtons1" Grid.Row="0" Grid.Column="0"
                               Header="TestRadioButtons"
                               SelectionChanged="TestRadioButtons_SelectionChanged"
                               GotFocus="TestRadioButtons_GotFocus"
                               LostFocus="TestRadioButtons_LostFocus">
            <sys:String>Item 1</sys:String>
            <sys:String>Item 2</sys:String>
            <sys:String>Item 3</sys:String>
        </controls:RadioButtons>

        <!-- Selected Index/Item and focus info UI -->
        <Grid Grid.Row="0" Grid.Column="1" Margin="10,0,0,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Row="0" Grid.Column="0">Selected Index:</TextBlock>
            <TextBlock x:Name="SelectedIndexTextBlock1" AutomationProperties.Name="SelectedIndexTextBlock1" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left">-1</TextBlock>
            <TextBlock Grid.Row="1" Grid.Column="0">Selected Item:</TextBlock>
            <TextBlock x:Name="SelectedItemTextBlock1" AutomationProperties.Name="SelectedItemTextBlock1" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left">null</TextBlock>

            <TextBlock Grid.Row="2" Grid.Column="0">Focused Index:</TextBlock>
            <TextBlock x:Name="FocusedIndexTextBlock1" AutomationProperties.Name="FocusedIndexTextBlock1" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left">-1</TextBlock>

            <TextBlock Grid.Row="3" Grid.Column="0">Has Focus:</TextBlock>
            <CheckBox x:Name="TestRadioButtons1HasFocusCheckBox" AutomationProperties.Name="TestRadioButtons1HasFocusCheckBox" Grid.Row="3" Grid.Column="1" IsTabStop="False"/>
        </Grid>

        <!-- Select by index UI -->
        <Grid Grid.Row="0" Grid.Column="2" Margin="10,0,0,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Column="0">Index to select:</TextBlock>
            <TextBox x:Name="IndexToSelectTextBox1" AutomationProperties.Name="IndexToSelectTextBox1" Grid.Column="1" Text="-1" Margin="5,0,0,0" VerticalAlignment="Top"
                     IsTabStop="False"/>
            <Button x:Name="SelectByIndexButton1" AutomationProperties.Name="SelectByIndexButton1" Grid.Column="2" IsTabStop="False" Click="SelectByIndexButton1_Click"
                    Margin="5,0,0,0" VerticalAlignment="Top">Select by index</Button>
        </Grid>

        <!-- RadioButtons test group 2 -->
        <controls:RadioButtons x:Name="TestRadioButtons2" Grid.Row="1" Grid.Column="0"
                               Header="TestRadioButtons2" Margin="0,10,0,0"
                               SelectionChanged="TestRadioButtons2_SelectionChanged"
                               GotFocus="TestRadioButtons2_GotFocus"
                               LostFocus="TestRadioButtons2_LostFocus">
            <sys:String>Item 1</sys:String>
            <sys:String>Item 2</sys:String>
            <sys:String>Item 3</sys:String>
        </controls:RadioButtons>

        <!-- Selected Index/Item and focus info UI -->
        <Grid Grid.Row="1" Grid.Column="1" Margin="10,10,0,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Row="0" Grid.Column="0">Selected Index:</TextBlock>
            <TextBlock x:Name="SelectedIndexTextBlock2" AutomationProperties.Name="SelectedIndexTextBlock2" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left">-1</TextBlock>
            <TextBlock Grid.Row="1" Grid.Column="0">Selected Item:</TextBlock>
            <TextBlock x:Name="SelectedItemTextBlock2" AutomationProperties.Name="SelectedItemTextBlock2" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left">null</TextBlock>

            <TextBlock Grid.Row="2" Grid.Column="0">Focused Index:</TextBlock>
            <TextBlock x:Name="FocusedIndexTextBlock2" AutomationProperties.Name="FocusedIndexTextBlock2" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left">-1</TextBlock>

            <TextBlock Grid.Row="3" Grid.Column="0">Has Focus:</TextBlock>
            <CheckBox x:Name="TestRadioButtons2HasFocusCheckBox" AutomationProperties.Name="TestRadioButtons2HasFocusCheckBox" Grid.Row="3" Grid.Column="1" IsTabStop="False"/>
        </Grid>

        <!-- Select by index UI -->
        <Grid Grid.Row="1" Grid.Column="2" Margin="10,0,0,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Column="0">Index to select:</TextBlock>
            <TextBox x:Name="IndexToSelectTextBox2" AutomationProperties.Name="IndexToSelectTextBox2" Grid.Column="1" Margin="5,0,0,0" VerticalAlignment="Top" Text="-1"
                     IsTabStop="False"/>
            <Button x:Name="SelectByIndexButton2" AutomationProperties.Name="SelectByIndexButton2" Grid.Column="2" IsTabStop="False" Click="SelectByIndexButton2_Click"
                    Margin="5,0,0,0" VerticalAlignment="Top">Select by index</Button>
        </Grid>
    </Grid>
</local:TestPage>
