<ResourceDictionary
    xmlns="https://github.com/avaloniaui"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:CompileBindings="True">
    <Design.PreviewWith>
        <ThemeVariantScope RequestedThemeVariant="Dark">
            <StackPanel Background="{DynamicResource SemiBackground0Color}">
                <RadioButton>Hello</RadioButton>
                <RadioButton>Hello</RadioButton>
                <RadioButton Theme="{DynamicResource CardRadioButton}">Hello</RadioButton>
                <RadioButton Theme="{DynamicResource PureCardRadioButton}">Hello</RadioButton>
            </StackPanel>
        </ThemeVariantScope>
    </Design.PreviewWith>
    <!--  Theme: Default, Button, Card, PureCard  -->
    <ControlTheme x:Key="{x:Type RadioButton}" TargetType="RadioButton">
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="VerticalAlignment" Value="Top" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="FontSize" Value="{DynamicResource RadioButtonFontSize}" />
        <Setter Property="Foreground" Value="{DynamicResource RadioButtonForeground}" />
        <Setter Property="Background" Value="{DynamicResource RadioButtonDefaultBackground}" />
        <Setter Property="BorderBrush" Value="{DynamicResource RadioButtonDefaultBorderBrush}" />
        <Setter Property="CornerRadius" Value="{DynamicResource RadioButtonBoxCornerRadius}" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Template">
            <ControlTemplate TargetType="RadioButton">
                <Border
                    Name="RootBorder"
                    Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    CornerRadius="{TemplateBinding CornerRadius}">
                    <Grid ColumnDefinitions="Auto,*">
                        <Panel
                            Grid.Column="0"
                            TemplatedControl.IsTemplateFocusTarget="True"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <Ellipse
                                Name="OuterEllipse"
                                Width="{DynamicResource RadioButtonIconRadius}"
                                Height="{DynamicResource RadioButtonIconRadius}"
                                Fill="{DynamicResource RadioButtonUncheckIconDefaultBackground}"
                                Stroke="{DynamicResource RadioButtonUncheckIconDefaultBorderBrush}"
                                StrokeThickness="{DynamicResource RadioButtonUncheckIconDefaultThickness}"
                                UseLayoutRounding="False" />

                            <Ellipse
                                Name="CheckGlyph"
                                Width="{DynamicResource RadioButtonGlyphRadius}"
                                Height="{DynamicResource RadioButtonGlyphRadius}"
                                Fill="{DynamicResource RadioButtonCheckGlyphFill}"
                                Stroke="{DynamicResource RadioButtonCheckGlyphFill}"
                                UseLayoutRounding="False" />
                        </Panel>
                        <ContentPresenter
                            Name="PART_ContentPresenter"
                            Grid.Column="1"
                            Margin="{DynamicResource RadioButtonContentMargin}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"
                            Foreground="{TemplateBinding Foreground}"
                            IsVisible="{TemplateBinding Content,Converter={x:Static ObjectConverters.IsNotNull}}"
                            FontSize="{TemplateBinding FontSize}"
                            RecognizesAccessKey="True"
                            TextWrapping="Wrap" />
                    </Grid>
                </Border>
            </ControlTemplate>
        </Setter>

        <!--  Unchecked State  -->
        <Style Selector="^:unchecked">
            <Style Selector="^ /template/ Ellipse#OuterEllipse">
                <Setter Property="Stroke" Value="{DynamicResource RadioButtonUncheckIconDefaultBorderBrush}" />
                <Setter Property="Fill" Value="{DynamicResource RadioButtonUncheckIconDefaultBackground}" />
            </Style>
            <Style Selector="^ /template/ Ellipse#CheckGlyph">
                <Setter Property="Opacity" Value="0" />
            </Style>

            <!--  Unchecked Pointerover State  -->
            <Style Selector="^:pointerover">
                <Style Selector="^ /template/ Ellipse#OuterEllipse">
                    <Setter Property="Stroke" Value="{DynamicResource RadioButtonUncheckIconPointeroverBorderBrush}" />
                    <Setter Property="Fill" Value="{DynamicResource RadioButtonUncheckIconPointeroverBackground}" />
                </Style>
            </Style>

            <!--  Unchecked Pressed State  -->
            <Style Selector="^:pressed">
                <Style Selector="^ /template/ Ellipse#OuterEllipse">
                    <Setter Property="Stroke" Value="{DynamicResource RadioButtonUncheckIconPressedBorderBrush}" />
                    <Setter Property="Fill" Value="{DynamicResource RadioButtonUncheckIconPressedBackground}" />
                </Style>
            </Style>

            <!--  Unchecked Disabled state  -->
            <Style Selector="^:disabled">
                <Style Selector="^ /template/ Ellipse#OuterEllipse">
                    <Setter Property="Stroke" Value="{DynamicResource RadioButtonUncheckIconDisabledBorderBrush}" />
                    <Setter Property="Fill" Value="{DynamicResource RadioButtonUncheckIconDisabledBackground}" />
                </Style>
                <Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
                    <Setter Property="Foreground" Value="{DynamicResource RadioButtonDisabledForeground}" />
                </Style>
            </Style>
        </Style>

        <!--  Checked State  -->
        <Style Selector="^:checked">
            <Style Selector="^ /template/ Ellipse#OuterEllipse">
                <Setter Property="Stroke" Value="{DynamicResource RadioButtonCheckIconDefaultBorderBrush}" />
                <Setter Property="Fill" Value="{DynamicResource RadioButtonCheckIconDefaultBackground}" />
            </Style>
            <Style Selector="^ /template/ Ellipse#CheckGlyph">
                <Setter Property="Opacity" Value="1" />
            </Style>

            <!--  Checked Pointerover State  -->
            <Style Selector="^:pointerover">
                <Style Selector="^ /template/ Ellipse#OuterEllipse">
                    <Setter Property="Stroke" Value="{DynamicResource RadioButtonCheckIconPointeroverBorderBrush}" />
                    <Setter Property="Fill" Value="{DynamicResource RadioButtonCheckIconPointeroverBackground}" />
                </Style>
            </Style>

            <!--  Checked Pressed State  -->
            <Style Selector="^:pressed">
                <Style Selector="^ /template/ Ellipse#OuterEllipse">
                    <Setter Property="Stroke" Value="{DynamicResource RadioButtonCheckIconPressedBorderBrush}" />
                    <Setter Property="Fill" Value="{DynamicResource RadioButtonCheckIconPressedBackground}" />
                </Style>
            </Style>

            <!--  Checked Disabled State  -->
            <Style Selector="^:disabled">
                <Style Selector="^ /template/ Ellipse#OuterEllipse">
                    <Setter Property="Stroke" Value="{DynamicResource RadioButtonCheckIconDisabledBorderBrush}" />
                    <Setter Property="Fill" Value="{DynamicResource RadioButtonCheckIconDisabledBackground}" />
                </Style>
                <Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
                    <Setter Property="Foreground" Value="{DynamicResource RadioButtonDisabledForeground}" />
                </Style>
            </Style>
        </Style>
    </ControlTheme>

    <ControlTheme x:Key="RadioButtonGroupBorder" TargetType="Border">
        <Setter Property="CornerRadius" Value="{DynamicResource RadioButtonGroupCornerRadius}" />
        <Setter Property="Background" Value="{DynamicResource RadioButtonGroupBackground}" />
    </ControlTheme>

    <ControlTheme x:Key="ButtonRadioButton" TargetType="RadioButton">
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Padding" Value="{DynamicResource RadioButtonButtonDefaultPadding}" />
        <Setter Property="Margin" Value="2" />
        <Setter Property="FontWeight" Value="{DynamicResource RadioButtonButtonFontWeight}" />
        <Setter Property="FontSize" Value="{DynamicResource RadioButtonButtonDefaultFontSize}" />
        <Setter Property="Foreground" Value="{DynamicResource RadioButtonButtonUncheckedForeground}" />
        <Setter Property="CornerRadius" Value="{DynamicResource RadioButtonButtonCornerRadius}" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Template">
            <ControlTemplate TargetType="RadioButton">
                <ContentPresenter
                    Name="PART_ContentPresenter"
                    Margin="{TemplateBinding Margin}"
                    Padding="{TemplateBinding Padding}"
                    HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                    VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                    Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Content="{TemplateBinding Content}"
                    ContentTemplate="{TemplateBinding ContentTemplate}"
                    CornerRadius="{TemplateBinding CornerRadius}"
                    RecognizesAccessKey="True"
                    TextElement.FontSize="{TemplateBinding FontSize}"
                    TextElement.FontWeight="{TemplateBinding FontWeight}"
                    UseLayoutRounding="False" />
            </ControlTemplate>
        </Setter>
        <Style Selector="^:unchecked">
            <Setter Property="Background" Value="Transparent" />
            <Style Selector="^:pointerover">
                <Setter Property="Background" Value="{DynamicResource RadioButtonButtonUncheckedPointeroverBackground}" />
            </Style>
            <Style Selector="^:disabled">
                <Setter Property="Foreground" Value="{DynamicResource RadioButtonButtonUncheckedDisabledForeground}" />
            </Style>
        </Style>
        <Style Selector="^:checked">
            <Setter Property="Background" Value="{DynamicResource RadioButtonButtonCheckedBackground}" />
            <Setter Property="Foreground" Value="{DynamicResource RadioButtonButtonCheckedForeground}" />
            <Style Selector="^:disabled">
                <Setter Property="Foreground" Value="{DynamicResource RadioButtonButtonCheckedDisabledForeground}" />
            </Style>
        </Style>
        <Style Selector="^.Small">
            <Setter Property="FontSize" Value="{DynamicResource RadioButtonButtonSmallFontSize}" />
            <Setter Property="Padding" Value="{DynamicResource RadioButtonButtonSmallPadding}" />
        </Style>
        <Style Selector="^.Large">
            <Setter Property="FontSize" Value="{DynamicResource RadioButtonButtonLargeFontSize}" />
            <Setter Property="Padding" Value="{DynamicResource RadioButtonButtonLargePadding}" />
        </Style>
    </ControlTheme>

    <ControlTheme x:Key="CardRadioButton" TargetType="RadioButton">
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Padding" Value="{DynamicResource RadioButtonCardPadding}" />
        <Setter Property="FontSize" Value="{DynamicResource RadioButtonFontSize}" />
        <Setter Property="CornerRadius" Value="{DynamicResource RadioButtonCardCornerRadius}" />
        <Setter Property="Background" Value="{DynamicResource RadioButtonCardDefaultBackground}" />
        <Setter Property="BorderThickness" Value="{DynamicResource RadioButtonBorderThickness}" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Template">
            <ControlTemplate TargetType="RadioButton">
                <Border
                    Name="RootBorder"
                    Padding="{TemplateBinding Padding}"
                    Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    CornerRadius="{TemplateBinding CornerRadius}">
                    <Grid
                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                        ColumnDefinitions="Auto,*">
                        <Panel
                            Grid.Column="0"
                            VerticalAlignment="Top"
                            Margin="{DynamicResource RadioButtonIconMargin}">
                            <Ellipse
                                Name="OuterEllipse"
                                Width="{DynamicResource RadioButtonIconRadius}"
                                Height="{DynamicResource RadioButtonIconRadius}"
                                Fill="{DynamicResource RadioButtonUncheckIconDefaultBackground}"
                                Stroke="{DynamicResource RadioButtonUncheckIconDefaultBorderBrush}"
                                StrokeThickness="1"
                                UseLayoutRounding="False" />

                            <Ellipse
                                Name="CheckGlyph"
                                Width="{DynamicResource RadioButtonGlyphRadius}"
                                Height="{DynamicResource RadioButtonGlyphRadius}"
                                Fill="{DynamicResource RadioButtonCheckGlyphFill}"
                                Stroke="{DynamicResource RadioButtonCheckGlyphFill}"
                                UseLayoutRounding="False" />
                        </Panel>

                        <ContentPresenter
                            Name="PART_ContentPresenter"
                            Grid.Column="1"
                            Margin="{DynamicResource RadioButtonContentMargin}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"
                            Foreground="{TemplateBinding Foreground}"
                            IsVisible="{TemplateBinding Content,Converter={x:Static ObjectConverters.IsNotNull}}"
                            RecognizesAccessKey="True"
                            FontSize="{TemplateBinding FontSize}"
                            TextWrapping="Wrap" />
                    </Grid>
                </Border>
            </ControlTemplate>
        </Setter>

        <!--  Unchecked State  -->
        <Style Selector="^:unchecked">
            <Style Selector="^ /template/ Ellipse#OuterEllipse">
                <Setter Property="Stroke" Value="{DynamicResource RadioButtonUncheckIconDefaultBorderBrush}" />
                <Setter Property="Fill" Value="{DynamicResource RadioButtonUncheckIconDefaultBackground}" />
            </Style>
            <Style Selector="^ /template/ Ellipse#CheckGlyph">
                <Setter Property="Opacity" Value="0" />
            </Style>

            <!--  Unchecked Pointerover State  -->
            <Style Selector="^:pointerover">
                <Setter Property="Background" Value="{DynamicResource RadioButtonCardUncheckPointeroverBackground}" />
                <Style Selector="^ /template/ Ellipse#OuterEllipse">
                    <Setter Property="Stroke" Value="{DynamicResource RadioButtonUncheckIconPointeroverBorderBrush}" />
                </Style>
            </Style>

            <!--  Unchecked Pressed State  -->
            <Style Selector="^:pressed">
                <Setter Property="Background" Value="{DynamicResource RadioButtonCardUncheckPressedBackground}" />
                <Style Selector="^ /template/ Ellipse#OuterEllipse">
                    <Setter Property="Stroke" Value="{DynamicResource RadioButtonUncheckIconPressedBorderBrush}" />
                </Style>
            </Style>

            <!--  Unchecked Disabled state  -->
            <Style Selector="^:disabled">
                <Style Selector="^ /template/ Ellipse#OuterEllipse">
                    <Setter Property="Stroke" Value="{DynamicResource RadioButtonUncheckIconDisabledBorderBrush}" />
                    <Setter Property="Fill" Value="{DynamicResource RadioButtonUncheckIconDisabledBackground}" />
                </Style>
                <Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
                    <Setter Property="Foreground" Value="{DynamicResource RadioButtonDisabledForeground}" />
                </Style>
            </Style>
        </Style>

        <!--  Checked State  -->
        <Style Selector="^:checked">
            <Setter Property="Background" Value="{DynamicResource RadioButtonCardCheckedBackground}" />
            <Setter Property="BorderBrush" Value="{DynamicResource RadioButtonCardCheckDefaultBorderBrush}" />
            <Style Selector="^ /template/ Ellipse#OuterEllipse">
                <Setter Property="Stroke" Value="{DynamicResource RadioButtonCheckIconDefaultBorderBrush}" />
                <Setter Property="Fill" Value="{DynamicResource RadioButtonCheckIconDefaultBackground}" />
            </Style>
            <Style Selector="^ /template/ Ellipse#CheckGlyph">
                <Setter Property="Opacity" Value="1" />
            </Style>

            <!--  Checked Pointerover State  -->
            <Style Selector="^:pointerover">
                <Setter Property="BorderBrush" Value="{DynamicResource RadioButtonCardCheckPointeroverBorderBrush}" />
                <Style Selector="^ /template/ Ellipse#OuterEllipse">
                    <Setter Property="Stroke" Value="{DynamicResource RadioButtonCheckIconPointeroverBorderBrush}" />
                    <Setter Property="Fill" Value="{DynamicResource RadioButtonCheckIconPointeroverBackground}" />
                </Style>
                <Style Selector="^ /template/ Ellipse#OuterEllipse">
                    <Setter Property="Stroke" Value="{DynamicResource RadioButtonCheckIconPointeroverBorderBrush}" />
                    <Setter Property="Fill" Value="{DynamicResource RadioButtonCheckIconPointeroverBackground}" />
                </Style>
            </Style>

            <!--  Checked Pressed State  -->
            <Style Selector="^:pressed">
                <Setter Property="BorderBrush" Value="{DynamicResource RadioButtonCardCheckPressedBorderBrush}" />
                <Style Selector="^ /template/ Ellipse#OuterEllipse">
                    <Setter Property="Stroke" Value="{DynamicResource RadioButtonCheckIconPressedBorderBrush}" />
                    <Setter Property="Fill" Value="{DynamicResource RadioButtonCheckIconPressedBackground}" />
                </Style>
            </Style>

            <!--  Checked Disabled State  -->
            <Style Selector="^:disabled">
                <Style Selector="^ /template/ Ellipse#OuterEllipse">
                    <Setter Property="Stroke" Value="{DynamicResource RadioButtonCheckIconDisabledBorderBrush}" />
                    <Setter Property="Fill" Value="{DynamicResource RadioButtonCheckIconDisabledBackground}" />
                </Style>
                <Style Selector="^ /template/ Border#RootBorder">
                    <Setter Property="BorderBrush" Value="{DynamicResource RadioButtonCheckIconDisabledBackground}" />
                    <Setter Property="Background" Value="{DynamicResource RadioButtonCardCheckedBackground}" />
                </Style>
                <Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
                    <Setter Property="Foreground" Value="{DynamicResource RadioButtonDisabledForeground}" />
                </Style>
            </Style>
        </Style>
    </ControlTheme>

    <ControlTheme x:Key="PureCardRadioButton" TargetType="RadioButton">
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Padding" Value="{DynamicResource RadioButtonCardPadding}" />
        <Setter Property="FontSize" Value="{DynamicResource RadioButtonFontSize}" />
        <Setter Property="CornerRadius" Value="{DynamicResource RadioButtonCardCornerRadius}" />
        <Setter Property="Background" Value="{DynamicResource RadioButtonCardDefaultBackground}" />
        <Setter Property="BorderThickness" Value="{DynamicResource RadioButtonBorderThickness}" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Template">
            <ControlTemplate TargetType="RadioButton">
                <ContentPresenter
                    Name="PART_ContentPresenter"
                    Padding="{TemplateBinding Padding}"
                    HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                    VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                    Foreground="{TemplateBinding Foreground}"
                    Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Content="{TemplateBinding Content}"
                    ContentTemplate="{TemplateBinding ContentTemplate}"
                    CornerRadius="{TemplateBinding CornerRadius}"
                    RecognizesAccessKey="True"
                    UseLayoutRounding="False"
                    TextWrapping="Wrap" />
            </ControlTemplate>
        </Setter>
        <Style Selector="^:unchecked">
            <Setter Property="BorderBrush" Value="{DynamicResource RadioButtonCardDefaultBorderBrush}" />
            <Style Selector="^:pointerover">
                <Setter Property="Background" Value="{DynamicResource RadioButtonCardUncheckPointeroverBackground}" />
            </Style>
            <Style Selector="^:pressed">
                <Setter Property="Background" Value="{DynamicResource RadioButtonCardUncheckPressedBackground}" />
            </Style>
            <Style Selector="^:disabled">
                <Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
                    <Setter Property="Foreground" Value="{DynamicResource RadioButtonDisabledForeground}" />
                </Style>
            </Style>
        </Style>
        <Style Selector="^:checked">
            <Setter Property="Background" Value="{DynamicResource RadioButtonCardCheckedBackground}" />
            <Setter Property="BorderBrush" Value="{DynamicResource RadioButtonCardCheckDefaultBorderBrush}" />
            <Style Selector="^:pointerover">
                <Setter Property="BorderBrush" Value="{DynamicResource RadioButtonCardCheckPointeroverBorderBrush}" />
            </Style>
            <Style Selector="^:pressed">
                <Setter Property="BorderBrush" Value="{DynamicResource RadioButtonCardCheckPressedBorderBrush}" />
            </Style>
            <Style Selector="^:disabled">
                <Setter Property="BorderBrush" Value="{DynamicResource RadioButtonCheckIconDisabledBackground}" />
                <Setter Property="Background" Value="{DynamicResource RadioButtonCardCheckedBackground}" />
                <Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
                    <Setter Property="Foreground" Value="{DynamicResource RadioButtonDisabledForeground}" />
                </Style>
            </Style>
        </Style>

    </ControlTheme>
</ResourceDictionary>