SfRadioGroup Nullable Boolean Binding in Listview

Hi,

we have a quality-management page with a listview as its content. It gets filled dynamically by database. If a Yes/No Question is in the List the default value is null. The user has to check "Yes" or "No" and then the result is saved in ResultBool.
We want to bind the value to the viewmodel (ObservableCollection) but the value will not change. We want to stay the value in if the user leaves the page and open it again so the binding is required. We made it via SfRadioGroup_CheckedChanged but its not checked anymore if the user re-open the page because of the missing binding.
Can you tell me how we solve this issue? Thanks!

            <ListView x:Name="listviewPruefungen"
            ItemsSource="{Binding Pruefungen}" HasUnevenRows="True" RowHeight="150" SelectionMode="None">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <Frame>
                                <StackLayout>
                                    <StackLayout Orientation="Horizontal">
                                        <buttons:SfRadioGroup IsVisible="{Binding Datatype, Converter={StaticResource SwitchConverter}}"                                                                                      Orientation="Horizontal" Spacing="30">
                                            <buttons:SfRadioButton x:Name="radioBtnYes" Text="Ja" FontSize="16" IsChecked="{Binding ResultBool.Value,Mode=TwoWay}"/>
                                            <buttons:SfRadioButton x:Name="radioBtnNo" Text="Nein" FontSize="16" />
                                        </buttons:SfRadioGroup>
                                    </StackLayout>
                                </StackLayout>
                            </Frame>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>


Regards 
Maria




2 Replies 1 reply marked as answer

YP Yuvaraj Palanisamy Syncfusion Team February 9, 2021 06:27 PM UTC

Hi Oliver Neis, 
 
Greetings from Synfusion. 
 
Currently we are validating your query and we will update the complete details on or before 10th February 2021. 
 
Regards, 
Yuvaraj. 



SM Saravanan Madheswaran Syncfusion Team February 10, 2021 12:24 PM UTC

Hi Oliver, 
 
 
We would like to let you know that you have bind the IsChecked property only for single radio button, So the property call back will not called when we checked on another radio button, hence it default value is similar to actual value.  
 
So, we have suggested to perform binding on both the radio buttons. Please check the below code snippet and modified sample below. 
 
<buttons:SfRadioGroup Orientation="Horizontal" Spacing="30"> 
    <buttons:SfRadioButton x:Name="radioBtnYes" Text="Yes" FontSize="16" IsChecked="{Binding YesChecked}"/> 
    <buttons:SfRadioButton x:Name="radioBtnNo" Text="No" FontSize="16" IsChecked="{Binding NoChecked}" /> 
</buttons:SfRadioGroup> 
 
 
Regards, 
Saravanan. 


Marked as answer
Loader.
Up arrow icon