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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SegmenetedControl Selection Changed fired on app load

Thread ID:

Created:

Updated:

Platform:

Replies:

147663 Sep 19,2019 06:05 AM UTC Sep 23,2019 10:56 AM UTC Xamarin.Forms 4
loading
Tags: SfSegmentedControl
Benjamin
Asked On September 19, 2019 06:05 AM UTC

it seems that Segmented Control's SelectionChanged Event is being fired twice when the app load.

when the event was fired first time the selectedIndex is -1, 2nd time it is 0.

how do i stop this such that the event will not fire at all during the first load 

i only want the event to fired when user actually go and change the control by clicking on it.

i am currently binding the event like this 
<buttons:SfSegmentedControl x:Name="monthDate" DisplayMode="Text" SelectionChanged="MonthDate_SelectionChanged" />

Muneesh Kumar G [Syncfusion]
Replied On September 19, 2019 12:42 PM UTC

Hi Benjamin, 
 
Greetings from Syncfusion.  
 
We have analyzed your query and we would like to inform you that we have fixed this problem with the feature “SfSegmentedControl without setting the SelectedItem when loading initially”. We have implemented this feature in our Vol 3 2019 release. By using this feature, you can achieve your requirement. This release will be available on Sep 20th, 2019. We will let you know once it gets rolled out.  
 
Regards,      
Muneesh Kumar G. 


Muneesh Kumar G [Syncfusion]
Replied On September 20, 2019 12:42 PM UTC

Hi Benjamin, 
 
We are glad to announce that our Essential Studio Volume 3 Beta (v17.3.0.9) is rolled out and is available for download under the following link. 
 
 
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 
 
Thanks, 
Muneesh Kumar G. 


Benjamin
Replied On September 23, 2019 02:04 AM UTC

Hi. i have updated my syncfusion with the beta release but segmented control is still getting fired on app load.

is there any additional setting i need to set for the control to prevent this?

Saravanan Madheswaran [Syncfusion]
Replied On September 23, 2019 10:56 AM UTC

Hi Benjamin, 
 
We have tried to reproduce the reported issue at our end with latest beta release. But the event not fired multiple times. We have attached the tested sample.

Sample – https://www.syncfusion.com/downloads/support/directtrac/general/ze/SimpleSample2078582983.zip  
 
We suspect that, you may have cache problem. So clear the NuGet cache as mentioned in KB- https://www.syncfusion.com/kb/6987/how-to-clear-nuget-cache   
 
And we also suspect the event fired multiple times is due to your implementation architecture. So, we suggested to use flag field to ignore code execution at event fire by workaround. If the workaround does not suit you please revert us by modifying the above sample, that will help us to validate further.  
 
        bool isLoad; 
        public MainPage() 
        { 
            isLoad = true; 
            InitializeComponent(); 
        } 
        private void Image_Text_SelectionChanged(object sender, SelectionChangedEventArgs e) 
        { 
          if(!isLoad) 
            { 
               /// your Configuration.  
            } 
 
            isLoad = false; 
        } 
 
Regards, 
Saravanan.  
 


CONFIRMATION

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