<ui:Page
    x:Class="ModernWpf.SampleApp.ControlPages.RadioButtonsPage"
    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:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:sc="clr-namespace:SamplesCommon;assembly=SamplesCommon"
    mc:Ignorable="d">

    <ScrollViewer>
        <ui:SimpleStackPanel Style="{StaticResource ControlPageContentPanelStyle}">
            <sc:ControlExample HeaderText="A group of radio buttons.">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <ui:RadioButtons
                        x:Name="Options"
                        Header="Options:">
                        <!-- A RadioButton group. -->
                        <RadioButton
                            x:Name="Option1RadioButton"
                            Content="Option 1" />
                        <RadioButton
                            x:Name="Option2RadioButton"
                            Content="Option 2" />
                        <RadioButton
                            x:Name="Option3RadioButton"
                            Content="Option 3" />
                    </ui:RadioButtons>
                    <TextBlock
                        x:Name="Control1Output"
                        Text="{Binding ElementName=Options, Path=SelectedItem.Content, StringFormat='You selected {0}.', FallbackValue='Select an option.'}"
                        Style="{StaticResource BodyTextBlockStyle}"
                        VerticalAlignment="Center"
                        Grid.Column="1"
                        Margin="8,0" />
                </Grid>
            </sc:ControlExample>

            <sc:ControlExample HeaderText="Two groups of radio buttons.">
                <StackPanel>
                    <ui:RadioButtons
                        x:Name="BackgroundRadioButtons"
                        MaxColumns="4"
                        Header="Background">
                        <RadioButton Content="Green" />
                        <RadioButton Content="Yellow" />
                        <RadioButton Content="Blue" />
                        <RadioButton
                            Content="White"
                            IsChecked="True" />
                    </ui:RadioButtons>
                    <ui:RadioButtons
                        x:Name="BorderBrushRadioButtons"
                        MaxColumns="4"
                        Header="BorderBrush"
                        SelectedIndex="1">
                        <sys:String>Green</sys:String>
                        <sys:String>Yellow</sys:String>
                        <sys:String>Blue</sys:String>
                        <sys:String>White</sys:String>
                    </ui:RadioButtons>
                    <Border
                        x:Name="Control2Output"
                        BorderThickness="10"
                        Background="{Binding ElementName=BackgroundRadioButtons, Path=SelectedItem.Content}"
                        BorderBrush="{Binding ElementName=BorderBrushRadioButtons, Path=SelectedItem}"
                        Height="50"
                        Margin="0,10,0,10" />
                </StackPanel>
            </sc:ControlExample>
        </ui:SimpleStackPanel>
    </ScrollViewer>
</ui:Page>
