RadListView with Switch fires Toggled event upon scrolling

0 Answers 67 Views
ListView ListView - Xamarin.iOS
Nivesh
Top achievements
Rank 1
Nivesh asked on 20 Sep 2022, 01:21 PM | edited on 20 Sep 2022, 01:23 PM

Hi,

I have a Xamarin Forms application using RadListView. As part of the ItemTemplate I have a Switch as described below:

<Switch
                HorizontalOptions="Start"
                IsEnabled="True"
                IsToggled="{Binding Toggle}"
                IsVisible="{Binding IsConfirmCheckVisible}"
                OnColor="Green"
                ThumbColor="Green">
                <Switch.Triggers>
                    <DataTrigger
                        Binding="{Binding Source={x:Reference chkConfirmCheck}, Path=IsToggled}"
                        TargetType="Switch"
                        Value="False">
                        <Setter Property="ThumbColor" Value="Red" />
                        <Setter Property="OnColor" Value="Red" />
                        <Setter Property="IsEnabled" Value="False" />
                    </DataTrigger>
                </Switch.Triggers>
                <Switch.Behaviors>
                    <behaviors:EventToCommandBehavior
                        Command="{Binding Source={x:Reference ParentBindingContext}, Path=BindingContext.UpdateTrickCommand}"
                        CommandParameter="{Binding .}"
                        EventName="Toggled" />
                </Switch.Behaviors>
            </Switch>

If I have a list of items in the RadListView and I start to scroll, then the Toggled event is fired on the Switch. All items for the RadListView is an ObservableCollection and it is loaded when the screen is opened. Is there an issue with the code above that would cause the Toggled event to be fired upon scrolling in a RadListView? This issue only appears on iOS and on a Phone. The iPad and Android devices behave as it's supposed to i.e. Just scrolls as normal and does not fire the Toggle event.

 Telerik UI For Xamarin Version: 2022.1.117.1
Didi
Telerik team
commented on 21 Sep 2022, 10:43 AM

the behavior could be because of the usage of the event to command behavior. 

I would suggest the following update Telerik, Xamarin, and Xamarin.Essentials versions to the latest and check whether the behavior will occur. If yes, please open a support ticket and attach a sample repro project to it. I want to review the complete implementation and debug the app on my side. 

No answers yet. Maybe you can help?

Tags
ListView ListView - Xamarin.iOS
Asked by
Nivesh
Top achievements
Rank 1
Share this question
or