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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SelectionChanged not fired on clear

Thread ID:

Created:

Updated:

Platform:

Replies:

142399 Jan 31,2019 01:33 PM UTC Feb 22,2019 05:07 AM UTC Xamarin.Forms 5
loading
Tags: SfAutoComplete
Dan Dumitrascu
Asked On January 31, 2019 01:33 PM UTC

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.

Dhanasekar R [Syncfusion]
Replied On February 1, 2019 11:30 AM UTC

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 


Dan Dumitrascu
Replied On February 19, 2019 01:39 PM UTC

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.

Dhanasekar R [Syncfusion]
Replied On February 20, 2019 12:54 PM UTC

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 


Dan Dumitrascu
Replied On February 20, 2019 12:59 PM UTC

Thank you, the workaround is good enough.

Selva Kumar  Veerakrishnan [Syncfusion]
Replied On February 22, 2019 05:07 AM UTC

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.

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

;