<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Controls="clr-namespace:MahApps.Metro.Controls"
                    xmlns:System="clr-namespace:System;assembly=mscorlib">

    <!--  ********************************** RadioButton Style **********************************  -->
    <!--  adapted from http://brianlagunas.com/free-metro-light-and-dark-themes-for-wpf-and-silverlight-microsoft-controls/  -->
    <Style x:Key="MetroRadioButton" TargetType="RadioButton">
        <Setter Property="Background" Value="{DynamicResource WhiteBrush}" />
        <Setter Property="BorderBrush" Value="{DynamicResource CheckBoxBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Controls:ControlsHelper.FocusBorderBrush" Value="{DynamicResource HighlightBrush}" />
        <Setter Property="Controls:ControlsHelper.MouseOverBorderBrush" Value="{DynamicResource CheckBoxMouseOverBrush}" />
        <Setter Property="FontFamily" Value="{DynamicResource ContentFontFamily}" />
        <Setter Property="FontSize" Value="{DynamicResource ContentFontSize}" />
        <Setter Property="Foreground" Value="{DynamicResource LabelTextBrush}" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="Padding" Value="6 0 0 0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="RadioButton">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition x:Name="LeftCol" Width="18" />
                            <ColumnDefinition x:Name="RightCol" Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid x:Name="PART_CHECKBOX">
                            <Rectangle Margin="-6 0" Fill="{DynamicResource TransparentWhiteBrush}" />
                            <Ellipse x:Name="normal"
                                     Width="18"
                                     Height="18"
                                     Fill="{TemplateBinding Background}"
                                     Stroke="{TemplateBinding BorderBrush}"
                                     StrokeThickness="{TemplateBinding BorderThickness}" />
                            <Ellipse x:Name="Checked1"
                                     Width="10"
                                     Height="10"
                                     Fill="{DynamicResource HighlightBrush}"
                                     Opacity="0" />
                            <Ellipse x:Name="disabled"
                                     Width="18"
                                     Height="18"
                                     Fill="{DynamicResource SemiTransparentWhiteBrush}"
                                     Opacity="0"
                                     StrokeThickness="{TemplateBinding BorderThickness}" />
                        </Grid>
                        <ContentPresenter x:Name="contentPresenter"
                                          Grid.Column="1"
                                          Margin="{TemplateBinding Padding}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          Content="{TemplateBinding Content}"
                                          ContentStringFormat="{TemplateBinding ContentStringFormat}"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                                          RecognizesAccessKey="True" />
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="contentPresenter"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To=".55"
                                                         Duration="0" />
                                        <DoubleAnimation Storyboard.TargetName="disabled"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="1"
                                                         Duration="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualState x:Name="Checked">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="Checked1"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="1"
                                                         Duration="0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unchecked" />
                                <VisualState x:Name="Indeterminate" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="normal" Property="Stroke" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ControlsHelper.MouseOverBorderBrush)}" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="normal" Property="Stroke" Value="{DynamicResource HighlightBrush}" />
                        </Trigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter TargetName="normal" Property="Stroke" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ControlsHelper.FocusBorderBrush)}" />
                        </Trigger>
                        <Trigger Property="Controls:ToggleButtonHelper.ContentDirection" Value="RightToLeft">
                            <Setter Property="Padding" Value="0 0 6 0" />
                            <Setter TargetName="LeftCol" Property="Width" Value="*" />
                            <Setter TargetName="PART_CHECKBOX" Property="Grid.Column" Value="1" />
                            <Setter TargetName="RightCol" Property="Width" Value="18" />
                            <Setter TargetName="contentPresenter" Property="Grid.Column" Value="0" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="VerticalContentAlignment" Value="Center" />
    </Style>

</ResourceDictionary>
