We have a need to allow users to select multiple values from a dropdown list in the grid. We have successfully created a custom column using Devin's blog post as a reference and we can get the values from the Editor control into the underlying object, but we cannot figure out what to do about the binding property in ResolveEditorControl. For single selection scenarios, we use:
m_Editor.SetBinding(XamComboEditor.SelectedItemProperty, editorBinding)
But that won't work for multi-select. We tried leaving the binding off, but the selected values are only displayed for the first item in the grid (although they appear to be persisted to the underlying data object). Any guidance would be greatly appreciated.
Hi,
So there isn't a really good way to do this.
First, SelectedItems isn't a DepenencyProperty, so you can't bind to it.
Even if it was, your underlying property would have to be a Settable Collection of a matching type ObservableCollection<object> in order for it to even be settable.
If you really needed to do it...your best it is to just rig up some events in your ColumnContent provider, and manually populate the comobBox, when it goes into edit mode. And then when the selection chagnes in the comboBox, manually update your underlying item.
-SteveZ
I can easily do that, since we do that a lot in Win Forms apps, but my primary issue is that I don't really understand from the documentation or any other resource that I have looked at, when to tell that a column is going into edit mode. Getting the data out of the control is trivial and quite obvious (ResolveValueFromEditor), but there doesn't appear to be an analogous ResolveValueForEditor (or whatever the appropriate name was). It would be extremely helpful to have more detailed documentation on the various methods, their execution order, and where it is appropriate to interact with the underlying data and/or editor control.