Hi there!
While using the SfPopup for a project, I've encountered an issue with radiobuttons when using a popup to show the radiobuttons. When opening the popup for the first time, the radiobuttons work as expected. You click the radiobutton, the radiobutton goes from an off state to an on state. You close the popup and then re-open it. When clicking any other radiobutton that isn't off, the radiobutton doesn't go to an on state. You have to click the button in question twice to change the state from off to on. I've added a link to a repo where you can see the behavior;
https://github.com/TwisterTies/sfpopupradiobuttons
Steps to reproduce;
- Open the popup by clicking the button on the screen
- Select one of three radiobuttons in the popup
- Close the popup by clicking outside of the popup
- Open the popup again and click any random radiobutton, the state doesn't change from off to on, only when double tapping
Has anybody else encountered this issue?
|
xmlns:syncfusion="clr-namespace:Syncfusion.XForms.Buttons;assembly=Syncfusion.Buttons.XForms"
xmlns:vm="clr-namespace:SfPopupRadioButtons.ViewModels.Base">
…
<DataTemplate>
<StackLayout>
<Grid Padding="20,30" RowSpacing="20">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="44"/>
</Grid.RowDefinitions>
<Label Grid.Row="0" LineHeight="1.2" Text="This is a title" x:Name="LabelTitle"/>
<Label Grid.Row="1" LineHeight="1.3" Text="Body text" x:Name="LabelBody"/>
<syncfusion:SfRadioGroup Grid.Row="2">
<syncfusion:SfRadioButton Padding="5" Text="Value 1" BackgroundColor="{DynamicResource BlockBackgroundColor}" />
<syncfusion:SfRadioButton Padding="5" Text="Value 2" BackgroundColor="{DynamicResource BlockBackgroundColor}" />
<syncfusion:SfRadioButton Padding="5" Text="Value 3" BackgroundColor="{DynamicResource BlockBackgroundColor}" />
</syncfusion:SfRadioGroup>
… |
|
Closed="SfPopupLayout_Closed"
xmlns:vm="clr-namespace:SfPopupRadioButtons.ViewModels.Base">
|
|
//Popup.xaml.cs
StackLayout outerstack;
private void RadioButton_CheckedChanged(object sender, Xamarin.Forms.CheckedChangedEventArgs e)
{
outerstack = (sender as RadioButton).Parent as StackLayout;
}
private void SfPopupLayout_Closed(object sender, System.EventArgs e)
{
outerstack.Children.Clear();
} |
Hi Suja,
The second solution you provided works perfectly, thank you for answering the question! :)