How to create Radio Group in MAUI?

72 Views Asked by At

I am new to MAUI. Here we have option to create RadioButton but when it comes to have RadioGroup I didn't find any exact solution.

I want to create dynamic list of RadioButtons. So something like RadioGroup could help with dynamic RadioButtons. I have overview Syn fusion library but if something available from MAUI team could help.

I have list of Employee and need to select single Employee from that list.

Below is the employee class here, kept one bool to manage selected part.

Class Employee{
       public int EmployeeId;
       public string EmployeeName;
       public book Isselected;
    }

Please let me know if you want more details. Thanks in advance.

I have tried List of RadioButton but has to manage checkuncheck by own. So if something like RadioGroup available, could help alot.

1

There are 1 best solutions below

0
Guangyu Bai - MSFT On

Maui has the methods to Group RadioButtons.

Radio buttons work in groups, and there are three approaches to grouping radio buttons:

  1. Place them inside the same parent container. This is known as implicit grouping.
  2. Set the GroupName property on each radio button in the group to the same value. This is known as explicit grouping.
  3. Set the RadioButtonGroup.GroupName attached property on a parent container, which in turn sets the GroupName property of any RadioButton objects in the container. This is also known as explicit grouping.

Here is the document about how to group the radio buttons.