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

Clearing selection using MVVM

I have this Combobox in xaml and I need to clear the selection after an edit cancel or after save.

I tried setting SelectProduct = null but it doesn't seem to work after the first time.
 public string  SelectedProduct
        {
            get { return _productName; }
            set
            {
                _productName = value;
                OnPropertyChanged("SelectedProduct");
            }
        }



          <syncfusion:ComboBoxAdv Name="ProductComboBox"
                                       VerticalAlignment="Center" Margin="3.5,0,0,0" 
                                        AllowMultiSelect="False"
                                       
                                        ItemsSource="{Binding ProductsList, Mode=TwoWay}"
                                        SelectedValue="{Binding  SelectedProduct, Mode=TwoWay}"
                                          SelectedValuePath="Product1" >
                        <syncfusion:ComboBoxAdv.ItemTemplate>

                            <DataTemplate>

                                <Grid>

                                    <StackPanel>


                                        <TextBlock Margin="0"
                                               HorizontalAlignment="Stretch"
                                               VerticalAlignment="Top"
                                               Text="{Binding Product1}"
                                                TextTrimming="CharacterEllipsis"
                                               TextWrapping="NoWrap" />



                                    </StackPanel>

                                </Grid>

                            </DataTemplate>

                        </syncfusion:ComboBoxAdv.ItemTemplate>


1 Reply

VR Venkateshwaran Ramdoss Syncfusion Team April 27, 2016 01:40 PM UTC

Hi Peter,

We have checked your provided code snippet. In this you have tried to clear the property "SelectedProduct". This won't clear the item in ComboBox. We were unable to understand your exact requirement. Could you please provide more information about your query like explaining about the exact requirement or providing sample and replication steps to reproduce the issue. It would help us to proceed further.

Regards,
Venkateshwaran V.R. 


Loader.
Live Chat Icon For mobile
Up arrow icon