This is how the combo box is defined in editor template in XAML:
<igGrid:TemplateColumn.EditorTemplate> <DataTemplate> <ComboBox SelectedItem="{Binding bbbb}"> <System:Int32>0</System:Int32> <System:Int32>1</System:Int32> <System:Int32>2</System:Int32> <System:Int32>3</System:Int32> </ComboBox> </DataTemplate> </igGrid:TemplateColumn.EditorTemplate>
The drop down shows 0, 1, 2, and 3. The Selected Item is bound to bbbb. After selecting an item, the item is successfully updated into the grid.
But, when entering edit mode Selected Item is null. Even when I set the value in CellEnteredEditModeEvent:
private void _igrid_CellEnteredEditMode(object sender, Infragistics.Silverlight.EditingCellEventArgs e) { if (e.Editor.GetType() == typeof(ComboBox)) { ((ComboBox)e.Editor).SelectedItem = e.Cell.Value; } }
private void _igrid_CellEnteredEditMode(object sender, Infragistics.Silverlight.EditingCellEventArgs e) {
if (e.Editor.GetType() == typeof(ComboBox)) { ((ComboBox)e.Editor).SelectedItem = e.Cell.Value; } }
if (e.Editor.GetType() == typeof(ComboBox)) { ((ComboBox)e.Editor).SelectedItem = e.Cell.Value; }
}
This results in the drop down being empty instead of displaying the current value.
However, I can assign the value in the debugger and it works correctly.
Hello,
Thank you for your feedback. I am glad that you have found the answer that you have been looking for.
Thanks for responding. I finally found the answer somewhere on the forums. This issue occurs due to use of anonymous types. Seems Combobox has problem binding to anonymous types.
I have been looking into your issue and maybe I miss something and I cannot reproduce your scenario. I am attaching the sample application that I have used and, if possible, modify it accordingly to your needs, or send me an isolated one which behaves as you reported.
Looking forward to hearing from you.