Search code examples
wpfxamlribbon

Change the look of a RibbonRadioButton


I am developing a Ribbon for my WPF application and I need to add two RibbonRadioButton into a RibbonGroup. I already did this, and everything works perfectly:

<rb:RibbonGroup>

   <rb:RibbonRadioButton Label="Option one" IsChecked="{Binding OptionOne}"  />
   <rb:RibbonRadioButton Label="Option two" IsChecked="{Binding OptionTwo}" />

</rb:RibbonGroup>

But the RibbonRadioButtons look like a "conventional buttons" and I need them to look like the classic pushable RadioButtons we all know which are made up of a little circle and a label.

So, Is there a way to change the look of the RibbonRadioButtons??

Thanks in advance


Solution

  • This worked for me:

    <rb:RibbonMenuButton.Resources>
        <ControlTemplate x:Key="RibbonRadioButtonControlTemplate1" TargetType="{x:Type rb:RibbonRadioButton}">
            <RadioButton GroupName="{Binding Name, RelativeSource={RelativeSource AncestorType=rb:RibbonGroup}}" Content="{TemplateBinding Label}" IsChecked="{Binding IsChecked}"/>
        </ControlTemplate>
    </rb:RibbonMenuButton.Resources>
    
        <rb:Ribbon HorizontalAlignment="Left" Margin="111,86,0,88.867" Width="289.14">
        <rb:RibbonGroup x:Name="grp1">
             <rb:RibbonRadioButton Label="Option one" IsChecked="{Binding OptionOne}" Template="{DynamicResource RibbonRadioButtonControlTemplate1}"  />
             <rb:RibbonRadioButton Label="Option two" IsChecked="{Binding OptionTwo}" Template="{DynamicResource RibbonRadioButtonControlTemplate1}" />
        </rb:RibbonGroup>
        </rb:Ribbon>