I am using MVVM pattern. I have a RadGridView and have bound the ItemsSource to a collection and SelectedItem to an individual item in the VM. This works, and I have some buttons to reorder the collection. They call a command on the VM that moves the SelectedItem up or down in the collection. This works fine but it appears that after the item gets moved, the SelectedItem becomes null. My goal is to be able to select an item in the RadGridView and then click the "Move Up" button several times to move the item up in the collection. Currently the experienced behavior is that I click the item and get one Move Up(or Down) before the SelectedItem becomes null and I am required to select an item to continue moving items. I have put debug statements in both the SelectionChanged and SelectionChanging events on the RadGridView.
Upon running my app, here is the order I see:
Upon running my app, here is the order I see:
Event |
SelectedItem |
SelectionChanging |
null |
SelectionChanged |
CorrectItem |
Move method |
CorrectItem |
SelectionChanging | CorrectItem |
SelectionChanged | null |
I even tried manually setting the SelectedItem in the VM after reordering it, but the reset to null appears to happen sometime after this.
I have the latest version (2013.1.220.45) installed and referenced in my project.
Please let me know if something is unclear.
Thanks,
Chris