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

SelectionChanged not fired on clear

If the control has SelectedItem property bound to an object, tapping clear button doesn't fire SelectionChanged event and SelectedItem is not set to null.

7 Replies

DR Dhanasekar R Syncfusion Team February 1, 2019 06:30 AM

Hi Dan Dumitrascu, 
 
Greetings from Syncfusion. 
 
We have validated this and we have already fixed this issue “tapping clear button doesn't fire SelectionChanged event” and included this in Version 16.4.0.48. Can you please upgrade NuGet to latest version (16.4.0.48)? 
 
Regards, 
Dhanasekar 



DD Dan Dumitrascu February 19, 2019 08:39 AM

Hi,

I upgraded to version 16.4.0.48

  1. SelectionChanged is fired
  2. But SelectedItem is set to empty string. So if I have SelectedItem={Binding SomeObject}, the app fails to set "SomeObject" since it's not a string. The expected value of SelectedItem is null.


DR Dhanasekar R Syncfusion Team February 20, 2019 07:54 AM

Hi Dan Dumitrascu,  
 
Sorry for the inconvenience. 
 
In our current implementation of SfComboBox on Xamarin.Forms Android platform, we have used empty string for the SelectedItem when pressing x-button. Due to code complexities and breaking changes on our control [in Android platform] we could not able to change this implementation for now. So we will consider this and it will be included in any of our upcoming release. 
 
If you are using MVVM structure, you can use the below workaround to achieve your requirement. 
 
Please use the below converter to get the EmptyStringToNullConverter. 
 public class EmptyStringToNullConverter : IValueConverter
    {

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value != null &&
                    (string.IsNullOrWhiteSpace(value.ToString())
                    || value.ToString().Equals("0.0")))
            {
                return null;
            }
            else
            {
                return value;
            }
        }
    } 
 
Also we have prepared a sample for the same, please download it from the link given below. 
 
 
Please let us know if you have any clarification on this. 
 
Note: If the issue is differ from the above provided solution, please let us know more details about the issue which you are facing at your end, this will be helpful for us to provide better solution on this. 
 
Regards, 
Dhanasekar 



DD Dan Dumitrascu February 20, 2019 07:59 AM

Thank you, the workaround is good enough.


SK Selva Kumar  Veerakrishnan Syncfusion Team February 22, 2019 12:07 AM

Hi Dan Dumitrascu,

Glad that the issue has been resolved. Please get back to us if any further assistance on this.

Regards,
Selva Kumar V.


AV Alexandre Vaz replied to Selva Kumar  Veerakrishnan April 10, 2020 05:07 PM

Hi Dan Dumitrascu,

Glad that the issue has been resolved. Please get back to us if any further assistance on this.

Regards,
Selva Kumar V.

Hi,


I am having the same trouble with the SfComboBox. 


In the iOS app, the problem is that the clear button is not triggering the SelectionChanged event.


Situation: if I get a value on SelectedItem from the view model (and not from the drop down list, for example on an edit view with forms already with values), when I tap the clear button the event is not triggered.


Also in an edit view, where the forms is already filled, the SelectionChanged should be triggered when the view gets SelectedItem property from the view model. This only happens on Android.


In the Android app, the SelectionChanged event works perfectly, but when I change the value of any other SfComboBox IsEnabled to false, and then I call again the SelectionChanged and set this IsEnabled to true, on Android the SfComboBox never becomes enabled again, on iOS it does.


Is it there any solution please? I just updated the latest version of Syncfusion 18.1.0.43.



Thanks for your attention!


Best regards,

Alexandre Vaz.



SP Sakthivel Palaniyappan Syncfusion Team April 13, 2020 08:55 AM

Hi Alexandre,

Greetings from Syncfusion.


We have prepared a sample based on your requirement but unfortunately, we are unable to reproduce the reported  issue from our side. Please find the sample from below link,

Sample: 
https://www.syncfusion.com/downloads/support/directtrac/general/ze/ComboBox_Index_21411608569


S
ince we are not aware of your exact scenario, so we request you to try our sample, if the issue still persists, could you please revert us by modifying the  provided sample with replication steps or provide sample or video. This will be helpful for us to investigate further and provide better solution at the earliest.

Regards,
Sakthivel P.
 
 


Loader.
Live Chat Icon For mobile
Up arrow icon