We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to use SfRadioButton inside paged ListView

Thread ID:





148143 Oct 8,2019 03:33 AM UTC Oct 14,2019 06:29 AM UTC Xamarin.Forms 4
Tags: SfRadioButton
Asked On October 8, 2019 03:41 AM UTC

Hi, can you please help me to deal with the following problem.
Let's say I have a list of issues and want to display one issue on a page. For creating list of pages, I used this: https://help.syncfusion.com/xamarin/sflistview/working-with-sflistview#paging
Each issue has a list of states: None, Backlog, In progress and Done. States should be displayed on each page as a SfRadioGroup to provide single selection. 
The problem is that when I tap on page 2, all SfRadioButton values on page 1 are setting to false. It happens after specifying ItemSource property for ListView in SfListViewPagingBehavior.cs : 
_listView.ItemsSource = source.AsEnumerable();
As a result, when I return to page 1, none of the SfRadioButtons is selected. What should I do in order to save selected SfRadioButton between navigating pages?
Please find the example with the described problem attached.

Attachment: PagingWithRadioButtons_b2ea1a56.rar

Geetha Rajendran [Syncfusion]
Replied On October 10, 2019 04:02 AM UTC

Hi Anton, 
We are currently checking this with high priority and will update you the complete details on today. 
Geetha R. 

Hemalatha Marikumar [Syncfusion]
Replied On October 10, 2019 06:05 PM UTC

Hi Anton,

Thanks for your patience.

We have analyzed your sample and you have used the same groupKey for all the SfRadioButtons which is placed inside the SfRadioGroup. We would like to let you know that, it’s not a valid scenario to use GroupKey within RadioGroup because both are doing the same job except GroupKey can be used for the RadioButtons which is placed inside any layout.

We have modified your sample by creating a new instance for GroupKey while getting ItemSource. Please refer the below code. 
Code snippet[XAML]: 
                                                         Text="{Binding Info}"/> 
                                                         BindableLayout.ItemsSource="{Binding States}"> 
                                                                                                    GroupKey="{Binding GroupKey}" 
                                                                                                    Text="{Binding Name}"  
                                                                                                    IsChecked="{Binding IsChecked,Mode=TwoWay}"/> 
Code snippet[C#]: IssueState.cs 
public class IssueState: INotifyPropertyChanged 
   public string Name { get; set; } 
   public SfRadioGroupKey GroupKey { get; set; } 
   . . .  
Code snippet [C#]: IssueViewModel.cs 
public class IssueViewModel: INotifyPropertyChanged 
    public SfRadioGroupKey GroupKey { get; set; } 
   private ObservableCollection<IssueState> _states; 
    public ObservableCollection<IssueState> States 
         GroupKey = new SfRadioGroupKey(); 
         if(_states != null) 
             foreach (var item in _states) 
                 item.GroupKey = GroupKey; 
         return _states; 
                 if (_states == value) 
                 _states = value; 
Please get back to us for further assistance. 
Hemalatha M. 

Replied On October 13, 2019 09:23 PM UTC

I realized my mistake. Thank you, guys. It is working now!

Hemalatha Marikumar [Syncfusion]
Replied On October 14, 2019 06:29 AM UTC

Hi Anton, 
Thanks for your update. 
Please let us know if you have any other query. 
Hemalatha M. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon