Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
905
How to unselect a RadioButtonTool
posted

I have RadioButtonTools within the same group, and all are behaving as expected

Is there a way to uncheck all buttons within the group after a button within the group has been clicked/checked?

Unchecking the ButtonTool in the click event has no effect (it gets checked again)

Thank you!

Parents
No Data
Reply
  • 6475
    Verified Answer
    posted

    Hi,

    Unchecking the RadioButtonTool in the click event should work. I tried it using the following code:

    XAML:

                        <ig:XamRibbonGroup Caption="Group1">
                            <ig:RadioButtonTool Caption="Radio Button 1"
                                                Click="RadioButtonTool_Click"
                                                GroupName="rbgroup"/>
                            <ig:RadioButtonTool Caption="Radio Button 2"
                                                Click="RadioButtonTool_Click"
                                                GroupName="rbgroup" />
                            <ig:RadioButtonTool Caption="Radio Button 3"
                                                Click="RadioButtonTool_Click"
                                                GroupName="rbgroup" />
                        </ig:XamRibbonGroup> 

     

    C#:

            private void RadioButtonTool_Click(object sender, RibbonToolEventArgs e)
            {
                RadioButtonTool rb = (RadioButtonTool)e.Tool;
                if (rb.IsChecked)
                {
                    this.Dispatcher.BeginInvoke(() =>
                    {
                        rb.IsChecked = false;
                    });
                }
            }
    

     

     

    Hope this helps,

Children