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.
Unfortunately, activation email could not send to your email. Please try again.

Clearing selection using MVVM

Thread ID:

Created:

Updated:

Platform:

Replies:

123847 Apr 26,2016 09:51 AM Apr 27,2016 09:40 AM WPF 1
loading
Tags: ComboBoxAdv
Peter Viau
Asked On April 26, 2016 09:51 AM

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>


Venkateshwaran Ramdoss [Syncfusion]
Replied On April 27, 2016 09:40 AM

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. 


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.

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.

;