0

I'm trying to customize the RadioButton button, but nothing changes in it. Why? And how to customize RadioButton to make it look like this: this is how it should look like

Also, can you tell me how to make the size of a round button 24x24? And how to implement its on/off?

That's how I tried to do it:

    <RadioButton x:Name="CS" Width="24" Height="24" 
Background="#9183E5" BorderBrush="#333335" BorderThickness="2" 
Checked="CS_Checked" Unchecked="CS_Unchecked" 
HorizontalAlignment="Center" VerticalAlignment="Center"/>
1

1 Answer 1

0

I’ve created a resource dictionary for the radio button style. You can customize the colors as needed. I hope you find it helpful! The center button in the attached image represents the selected radio button.

enter image description here

Below is the radio button style.

<Style TargetType="RadioButton">
    <Setter Property="Background" Value="Transparent"/>
    <Setter Property="BorderBrush" Value=" #404040"/>
    <Setter Property="BorderThickness" Value="2"/>
    <Setter Property="Height" Value="50"/>
    <Setter Property="Width" Value="50"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="RadioButton">
                <Border x:Name="bd" CornerRadius="25" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                    <Ellipse x:Name="ec"   Width="40"    Height="40"    Fill="#cce0ff"    />
                </Border>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsChecked" Value="True">
                        <Setter TargetName="ec" Property="Fill" Value="#0047b3"/>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.