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

Adding a new item to the GridViewComboBoxColumn after setting the ItemsSource property

1 Answer 89 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jorge Alberto
Top achievements
Rank 1
Jorge Alberto asked on 23 Jul 2010, 09:28 PM
Hello :)

This is my scenario:

I have a gridview with a GridViewComboBoxColumn with the property isComboBoxEditable set to true and the ItemsSource property set to a List<T> (the data of this list is populated from a data base). The SelectedValueMemberPath set to a property of the T object and the DisplayMemberPath set to an another property of T. Everything works as expected. 

I would like to know how can I do the following if possible:
The reason for the isComboBoxEditable is set to true is that I want the user to add new items to the GridViewComboBoxColumn, then I save this new item to the data base and then display the combobox with the new item. So how can I access the combobox and add the new item and then display the combobox list with the new item? I guess refreshing the combobox, refreshing the row, or refreshing the entire gridview could help because all the combobox in the rows created previously must have the new created item too.

I hope you can help me.

Best regards,
Jorge Alberto

1 Answer, 1 is accepted

Sort by
0
Ahmet Özgür
Top achievements
Rank 1
answered on 26 Jul 2010, 07:17 AM
Hello,

as i know you mast add your new item to your list. if your binding mode is set to two way the combo box will get it automatically. you can not add an item to a control after setting its items source.
Tags
GridView
Asked by
Jorge Alberto
Top achievements
Rank 1
Answers by
Ahmet Özgür
Top achievements
Rank 1
Share this question
or