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

Populating ComboBoxColumn when drop down is opened

1 Answer 174 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Gary
Top achievements
Rank 1
Gary asked on 22 Jun 2009, 05:51 PM
I know it's not intuitive, but I have a requirement that I support allowing a combobox column to be populated with items when the drop down event occurs.  So I've exteded the built in combo box editor setting to expose the DropDownOpened event, and when this event occurs the ItemsSource for the combo (an IList<String>) is cleared and then populated with items.  This works for the most part.  What I've noticed is that the first combo box cell to get edited and droped down, that when a selection is made, that the when I move off the cell (commit the edit to the cell) the non-edit value reverts back to the previous value (the value it was orginally bound to).  All other cells for that column (in other rows) work as expected.

I'm thinking this is occuring for the first cell because when it's editor cell is generated the ItemsSource list is empty.  Do you know if there's anything I can change to work around this issue?  If possible (I don't see a way to attach files these threads), I can send you a very simple test project which demonstrates this.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Gary
Top achievements
Rank 1
answered on 22 Jun 2009, 06:06 PM
I just found a workaround.  Adding a single empty string to the list when I set the ItemsSource property prevents this issue from happening.
Tags
GridView
Asked by
Gary
Top achievements
Rank 1
Answers by
Gary
Top achievements
Rank 1
Share this question
or