I am using the code provided by Krasimir found here:
With it I have a XamDataGrid where a column contains a XamMultiSelectionComboEditor where users can select multiple options from the list. It works really well except that if a user selects options and uses the Enter key to accept and close (instead of clicking outside to lose focus), the selections are lost.
I have found that in OnEditModeEnding, the combo.SelectedItems is not updated with the selections and so while it is trying to save, the options aren't there to do it.
Can anyone suggest a fix? I am using 18.2.
When I am running Krasimir’s latest sample from the other post, I am unable to have any values stay in the multi-select combo editors. As such, I am going to recommend an alternate sample project, as it appears the post you have linked is also over 5 years old, and I have more recently written a sample that handles this behavior in a better way.
In the sample I am attaching, there is a converter that converts the SelectedItems collection from a string on the underlying data item to an object that the XamComboEditor can work with. There is also an attached behavior on the XamComboEditor that, on SelectionChanged converts the SelectedItems to the string property on the underlying data item. This may seem like overkill, but in my experience with the XamDataGrid, one thing it does not play well with is multi-select combo editors, and this converter/behavior method allows it to work without removing selected values, even when scrolling.
I hope the sample project helps you. Please let me know if you have any other questions or concerns on this matter.
Sincerely, Andrew Goldenbaum Software Developer
I appreciate your response, and I'm happy to move to a more modern method. One thing I noticed in the test app, is that I was doing a sequence of selecting a new name and hitting the enter key. It seems like it is only saving the last two selected names, despite others being checked when I hit the enter key. I looked to see if that was something you had in there, but I didn't see it.
I have taken another look at the sample project, but I cannot seem to see the behavior you are seeing. I am testing against the latest service release of 18.2, which is version 18.2.20182.281. If you are using a different version, please let me know.
In addition, I’d also like to get a little more of an idea of the behavior you are actually seeing. In this case, if you press the Enter key, are you seeing all items except for the last two selected items saved? I would expect that if you keyboard-navigate to one of the items in the drop-down and press Enter, the checked status of that single item will change to the opposite of what it currently is, but I would not expect only the last two items to be saved. What exactly is the behavior you are seeing?
Please let me know if you have any other questions or concerns on this matter.
I was using 18.2.20182.186. After updating to .281, the issue no longer appears.