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. Image for the cookie policy date

SegmenetedControl Selection Changed fired on app load

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" />

4 Replies

MK Muneesh Kumar G Syncfusion Team 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.  
Muneesh Kumar G. 

MK Muneesh Kumar G Syncfusion Team 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. 
Muneesh Kumar G. 

BE Benjamin 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?

SM Saravanan Madheswaran Syncfusion Team 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; 
        private void Image_Text_SelectionChanged(object sender, SelectionChangedEventArgs e) 
               /// your Configuration.  
            isLoad = false; 

Live Chat Icon For mobile
Up arrow icon