RadioButton crashes when using DataTriggers

Hello,


I'm migrating a personal survey forms project from Xamarin Forms to .netMaui.


Initially everything works perfectly in Xamarin Forms, but once I copied the codes into the .net Maui project, the behavior of the controls became strange.


1) when loading the list of options (radiobutton) everything happens perfectly.

2) when loading the record (for editing), the previously marked option can no longer be edited.

I use Triggers (DataTriggers) to load the previously saved option.


I thank my friends in advance for their help.


Image_3226_1718051378783


2 Replies

JE Jefter June 11, 2024 03:46 AM UTC

 .mp4  attached video


Attachment: ERRO_SYNCFUSION_78156aa6.zip


BV Brundha Velusamy Syncfusion Team June 11, 2024 12:01 PM UTC

Hi Jefter,


Thank you for reaching out Syncfusion support.


We have examined your request and developed a solution based on the information provided. Since we are not aware of your specific code setup, we have developed a general solution that should help resolve the problem. Below is a snippet illustrating the suggested approach. We recommend to use this suggestion on your project.


Here's the code snippet for your reference:

//Xaml

<ContentPage.Resources>

    <buttons:SfRadioGroupKey x:Key="respgroup"

   CheckedChanged="radioGroup_CheckedChanged"/>

</ContentPage.Resources>

 

//Code Behind

private void radioGroup_CheckedChanged(object sender, CheckedChangedEventArgs e)

{

    var selectedItem = e.CurrentItem.Text;

    if (selectedItem != null)

    {

        foreach (var item in viewModel.ItemsList)

        {

            if (selectedItem.Equals(item.Texto))

            {

                item.Respondido = "1";

            }

            else

            {

                item.Respondido = "0";

            }

        }

    }

}


If your requirements deviate from this proposed solution, please furnish detailed specifications and include the complete code or a sample project to enable a more thorough investigation and tailored solution.


Regards,

Brundha V


Loader.
Up arrow icon