Here's the scenario:
I'm binding my DataGrid to a list of ObjectA. ObjectA has a couple of simple properties that should be displayed in the DataGrid and an property of type IEnumerable<ObjectB> (EnumarableProperty). The IEnumerable is supposed to be in a combobox on each line in the grid. But I only get the "+" infront of each record. What am I doing wrong:
<DataPresenter:Field Name="EnumerableProperty" Label="WC#"> <DataPresenter:Field.Settings> <DataPresenter:FieldSettings EditorType="{x:Type igEditors:XamComboEditor}" > <DataPresenter:FieldSettings.EditorStyle> <Style TargetType="{x:Type igEditors:XamComboEditor}"> <Setter Property="ItemsSource" Value="{Binding EnumerableProperty}" /> <Setter Property="IsEditable" Value="True" /> </Style> </DataPresenter:FieldSettings.EditorStyle> </DataPresenter:FieldSettings> </DataPresenter:Field.Settings> </DataPresenter:Field>
Hello,
Well, this is because the XamComboEditor does not exit edit mode until it loses focus. However, you can end the edit mode explicitly. All you have to do is handle the ValueChanged event of the XamComboEditor ( you can subscribe for it in the XamComboEditor's style with EventSetter) and call the EndEditMode(...) method of the XamComboEditor.
Eventually got the ComboEditor working. Had to create a propert in my ViewModel "SelectedObjectB", have that property displayed as a ComboEditor in the DataGrid, and bind the ItemsSource of the comboeditor to my IEnumerable<ObjectB> in my ViewModel.
But I'm having a small issue none the less:
When the user changes the selected item in the combobox, some of the fields in the DataGrid changes their contents. (The properties on my ViewModel that is shown in the datagrid reflects properties on the selected ObjectB). It works ok actually, but the propblem is that when the user changes the selected item in the ComboEditor, the other fields don't update until the ComboEditor looses focus. I want the changes to happen at the moment a diffrent item is chosen in the ComboEditor.
Any ideas?