Problem with SfTabView_SelectionChanged

Hi,

I noticed that when I click on a tab, any of the three, the event runs twice.

Why?

Where am I wrong?

Thank you

This is my code behind:

private void SfTabView_SelectionChanged(object sender, Syncfusion.XForms.TabView.SelectionChangedEventArgs e)

        {

            if (e.Index == 0)

            {

                LbTitle.Text = "HOME";

                BindingContext = new ClientiViewModel();

                Device.StartTimer(TimeSpan.FromSeconds(1), () =>

                {

                    var data = BindingContext as ClientiViewModel;


                    foreach (var clientis in data.PropertyClientis)

                    {

                        data.IsActive = false;

                    }

                    return false;

                });

                return;

            }


            if (e.Index == 1)

            {

                LbTitle.Text = "PRODUCT";

                BindingContext = new ProdottiViewModel();

                Device.StartTimer(TimeSpan.FromSeconds(1), () =>

                {

                    var data = BindingContext as ProdottiViewModel;


                    foreach (var prodottis in data.PropertyProducts)

                    {

                        data.IsActive = false;

                    }

                    return false;

                });

                Parametri.ActiveMenuImprese = false;

            }


            if (e.Index == 2)

            {

                LbTitle.Text = "NOTIZIE";

                BindingContext = new NewsViewModel();

                Device.StartTimer(TimeSpan.FromSeconds(1), () =>

                {

                    var data = BindingContext as NewsViewModel;


                    foreach (var notizies in data.Notizies)

                    {

                        data.IsActive = false;

                    }

                    return false;

                });

                Parametri.ActiveMenuImprese = false;

            }

        }




1 Reply

AJ AhamedAliNishad JahirHussain Syncfusion Team May 17, 2023 01:34 PM UTC

Hi Fabio,

 

We have created a simple sample based on your provided code snippet, but we were unable to reproduce the reported scenario on our end. We observed that the SelectionChanged event of the tabview fires once when any of the three tabs is clicked.To better understand the root cause and assist with resolving the issue, it would be helpful if you could provide more detailed information about the scenario in which our control was used, including a sample demonstrating the issue with replication steps. Please let us know if you have any other queries.

 

Kindly review the attached example and apply any required modifications to reproduce the problem. Afterward, kindly forward the sample to us, as it would enable us to conduct a more thorough investigation of the issue.

 

Regards,

Ahamed Ali Nishad.


Attachment: TabViewSelection_de8c3cad.zip

Loader.
Up arrow icon