This is a migrated thread and some comments may be shown as answers.

GridViewComboBoxColum with IsComboBoxEditable="true" never sets value

3 Answers 107 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Joe Sharp
Top achievements
Rank 1
Joe Sharp asked on 24 Apr 2012, 03:51 PM
I have the following column in a grid:
<t:GridViewComboBoxColumn IsComboBoxEditable="True"
            DataMemberBinding="{Binding Path=QuoteNum, Mode=TwoWay}"
            Header="Quote" Width="125"
            ItemsSource="{Binding Path=AvailableQuotes, Mode=OneWay}" />

The ItemsSource is a simple IEnumerable<string>, and the combo shows the values from the ItemsSource, but I also want to allow the user to input a value that is not in the list (ItemsSource), hence the IsComboBoxEditable="True".

However, whenever you type in a value to the combobox, the value is lost and the column is left unset.  In fact, as far as I can tell the property setter on the view model is never actually called.

What am I doing wrong?

3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 24 Apr 2012, 03:58 PM
Hi Joe,

Please take a look at this forum thread and the attached sample project (EditableCombo_WPF) for a reference.

Regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Joe Sharp
Top achievements
Rank 1
answered on 24 Apr 2012, 07:00 PM
So, based on that thread, am I to understand that the GridViewComboBox will not accept a value that is not already in the list portion (ie. the ItemsSource), and so you need to dynamically add it to the list when it's entered?

Because I'm working in an MVVM environment and I don't think that is going to work for me.
0
Maya
Telerik team
answered on 25 Apr 2012, 07:38 AM
Hello Joe,

Generally, you can write down a particular value while editing combo box column, but unless this value is a part of the source, it will not be saved as value for the particular property of the underlying data item of the grid. The connection between the source of the column and that of the grid is SelectedValueMemberPath (ID) on one hand and DataMemberBinding (CountryID) on the other. So, if you enter a new value (Name) and it does not have a value for the property set in SelectedValueMemberPath (ID),CountryID will not be updated.

Greetings,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Joe Sharp
Top achievements
Rank 1
Answers by
Maya
Telerik team
Joe Sharp
Top achievements
Rank 1
Share this question
or