I've managed to get a combo box to work as the editor for a field on my grid. However the only examples I have seen have the items hard coded in the XAML. I need the items in the combo box to be populated from a datasource - not the same one as the grid either.
I've spent a while trying to do this but seem to be nor further forwards.
Can anyone help ?
We did use a XamComboBox (see above code suggestion)
Mike
Hi
how did you manage to get a "plain" combo (not XamCombo) in your grid?
Thank you very much
Regards
Klaus
We add and bind our XamComboEditors like so in procedural code(C#):Field field = new Field();field.Name = fieldName;field.Label = label;field.Settings.EditorType = typeof(XamComboEditor);ComboBoxItemsProvider cbip = new ComboBoxItemsProvider();cbip.ItemsSource = data;cbip.DisplayMemberPath = displayField;cbip.ValuePath = valueField;cbipList.Add(cbip);
Setter setter = new Setter();setter.Property = XamComboEditor.ItemsProviderProperty;setter.Value = cbip;Style style = new Style(typeof(XamComboEditor));style.Setters.Add(setter);field.Settings.EditorStyle = style;dataGrid.FieldLayouts[0].Fields.Add(field);
Hope it helps!Mike
Hi,
One way you can do this is to add the data source to the Resources collection of the window or the data grid and then use DynamicResource syntax to set the ItemsSource property of the combo box to that data source.
Hope this helps,
Sandip