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
close icon

Clear selection once selected

Hi,
I would like to know if there is an easy way to clear the selection once it is selected (I am using it as a Dropdown.. i.e. single selection only) and my ComboBox is bound to a list of collection..

This is my Xaml

<syncfusion:ComboBoxAdv x:Name="FirstInvestor" Margin="10,0,0,10"
                                                               Grid.Column="1" Grid.Row="0"
                                                               ItemsSource="{Binding Investors, Mode=TwoWay, NotifyOnValidationError=True, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
                                                               Validation.Error="Validation_Error"
                                                               SelectedItem="{Binding Investment.FirstInvestor, Mode=TwoWay, NotifyOnValidationError=True, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
                                                               DisplayMemberPath="FullName" MaxWidth="400" 
                                                               SelectionChanged="FirstInvestor_OnSelectionChanged"
                                                               />

7 Replies

VI Vinothini Syncfusion Team April 28, 2017 12:16 PM UTC

Hi Andy, 
 
Thank you for using Syncfusion products. 
 
We have used the given code snippet with the list collection in our sample, but we were not clear about your requirement. Can you brief about your requirement of clearing the selection of SelectedItems and the property bound to SelectedItem?  
 
Please provide us the information, so that we can work on it to provide you a solution. 
 
Regards, 
Vinothini 



AJ Andy Johnson May 1, 2017 02:19 PM UTC

Ok,I have created a solution to re-create the issue I have.. Please run the project and you will see two choices "Andy" and "Johnson". Once you select any of the choices, there is no way for us to clear the selection in case of non-required fields if I decide to not fill-in that field.ThanksAndyAttachment: ComboBoxAdv_9aea0a77.zip


VI Vinothini Syncfusion Team May 2, 2017 11:13 AM UTC

Hi Andy, 
 
Thank you for your update. 
 
We can clear the SelectedItem as per your requirement by setting the SelectedItem binding property to null. We have prepared sample for this and it is available below. 
 

Please let us know whether this solution works. 
 
Regards, 
Vinothini.R 



AJ Andy Johnson May 9, 2017 06:22 PM UTC

Vinothini,
I run the sample code you provided and figured that is only the solution to provide a clear button to clear the selection..
But if you run your code and do the following steps:

  1. Select any name from the list
  2. Clear name using a button
  3. Try to select the name again.

Here there seems to be a bug where newly selected item is not being displayed. Can you please help me with this?

Thanks



VI Vinothini Syncfusion Team May 10, 2017 09:43 AM UTC

Hi Andy, 
 
We have checked the provided sample with the given steps and we could find that items can be cleared and selected again. In this case, the selected item is displayed. Could you please check with the below video and let us know whether we have missed any steps, 
 
 
Regards, 
Vinothini.R 



AJ Andy Johnson May 11, 2017 01:58 PM UTC

Please look at the video from my end. Same code.


Attachment: 20170511_85512_39483216.zip


KJ Keerthana Jegannathan Syncfusion Team May 12, 2017 06:42 AM UTC

Hi Andy, 
 
We considered this defect “SelectedItem has not been updated properly in ComboBoxAdv” as bug and a support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates. 
 
 
Regards, 
 
Keerthana J 


Loader.
Live Chat Icon For mobile
Up arrow icon