AspBucket offers ASP.NET, C#, VB, Jquery, CSS, Ajax, SQL tutorials. It is the best place for programmers to learn

Thursday 5 January 2017

How to create a custom style for Radio button in WPF?

In this article I am going to explain how to create a custom styling for wpf radio-button. We can modify the radio-button according to our custom requirement.  Please check below code for modifying the template & creating custom radio-button in WPF.

    <Image Source="selected.png" x:Key="RadioButtonOn" Width="18" Height="18"/>
    <Image Source="unselected.png" x:Key="RadioButtonOff" Width="18" Height="18"/>
    <Style TargetType="RadioButton" x:Key="myCustomRadioButton">
        <Setter Property="FontFamily" Value="Segoe UI semibold"/>
        <Setter Property="FontSize" Value="13"/>
        <Setter Property="Foreground" Value="#94979b"/>
        <Setter Property="Template">
                <ControlTemplate TargetType="{x:Type RadioButton}">
                        <Image Source="unselected.png" Width="18" Height="18"/>
            <Trigger Property="IsChecked" Value="True">
                <Setter Property="Content" Value="{DynamicResource RadioButtonOn}"/>
            <Trigger Property="IsChecked" Value="False">
                <Setter Property="Content" Value="{DynamicResource RadioButtonOff}"/>


Post a Comment

  • Popular Posts
  • Comments