ButtonAdv IsChecked Grouping

Hello,


I am trying to achieve achieve a radio-button type behavior between a 'group' of ButtonAdv controls (MVVM design pattern). I have two issues:

  1. If I have a ButtonAdv 'toggled' on, then click on a SfDataGrid, the button toggles off, however the bound value shows that 'IsChecked = true'. Is there a way to disable this functionality so that the button stays toggled unless another AdvButton is selected?
  2. If I bind the IsChecked property of each of three buttons with only one of them being checked on the initiation of the View, the button does not display the correct 'checked' state (however the underlying binding variable is showing the correct toggling, as well as other actions occur each time the button is clicked showing that the binding is working). Is there a reason the display doesn't seem to match the binding? 
C#:
       private bool showSelection;


        public bool ShowSelection
        {
            get { return showSelection; }
            set
            {
                SetProperty(ref showSelection ,value);


                if(ShowSelection == true)
                    ChangeView(SectionType.Selection);
            }
        }


XAML:

            <StackPanel>

                <syncfusion:ButtonAdv Content="Patient Selection" Height="30" Width="200" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="10 5 0 0" IsCheckable="True" IsChecked="{Binding ShowSelection, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource PrimaryButton}"/>
                <syncfusion:ButtonAdv Content="Compliance Check" Height="30" Width="200" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="10 5 0 0" IsCheckable="True" IsChecked="{Binding ShowCompliance, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource PrimaryButton}"/>
                <syncfusion:ButtonAdv Content="Model Validation" Height="30" Width="200" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="10 5 0 0" IsCheckable="True" IsChecked="{Binding ShowValidate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource PrimaryButton}"/>
            </StackPanel>



3 Replies

AA Arunthivakar Azhagu Syncfusion Team December 27, 2021 04:30 PM UTC

Hi Jonathan,


Greetings from Syncfusion.


We have checked your reported query “ButtonAdv IsChecked Grouping” and we could not reproduce the reported two issues at our end.


Please check the attached sample and confirm us if the reported two issues occurs. If not please modify the sample as issue reproduceable or share the video which will be helpful for us to provide the prompt solution on this.


Sample link: https://www.syncfusion.com/downloads/support/forum/171471/7z/ButtonAdv237783438 


Regards,

Arunthivakar A.



PP Paul Parkins December 3, 2024 11:30 AM UTC

This sample does not demonstrate the mutually-exclusive selection of only a single button being pressed at a time, that a radio button exhibits, and that both the OP and myself were looking for




BS Bhaskar Suresh Syncfusion Team December 6, 2024 07:59 AM UTC

Hi Paul Parkins,


We have prepared a sample to achieve your requirement of making the ButtonAdv controls to behave like RadioButton. Please refer to the attached sample and let us know your concerns.


Regards,

Bhaskar Suresh


Attachment: ButtonAdv_RadioButton_5add457.zip

Loader.
Up arrow icon