By default, putting a filter cell into edit mode causes SelectedItemsChanging/Changed to fire, which clears any previously selected item(s) from the Grid.
is there a suggested way to suppress/prevent this behavior?
More Info 2010-11-3
The exact events fired by the grid when a FilterRecord cell is focused in RecordDeactivating and RecordActivating. Since we are binding ActiveDataRecord to our ViewModel's SelectedItem, the Selected item is clearing, the detail area of the Master Detail View is clearing etc. After the filter is applied, the original selected item is "lost".
Client request is to preserve the selection (and thus the ActiveDataItem) while the filter is being applied. is there any way to do this while still using the built-in filter record/cells/presenters etc.?
Thanks for any input
I second what ralexander said. Why would a user ever want the SelectedItems to be cleared, or the ActiveRecord to be cleared when the user applies a filter? There may be a time or two, but would that really be the common case?
I'm facing this issue right now. I would like the active item to always be active, whether the user is creating a filter or not. So, I'm going to need to style the RecordCellPresenter so that it can always *appear* that it is active or selected. Why should I need to do this? Can you please fix it?
Can't believe there has to be such a workaround for what is basic master detail situation. This is very poor behavior on the xamdatagrid's part. Simply clicking on the filter row dropdown causes the active item to be deselected. I consider that a bug in the datagrids implementation of a filter row.
Steve,
Thanks for the reply, I am still working on this. As much as I like your suggestions of work-arounds, the client is decided on what they want the user experience to be. They still want to be able select rows as normal and have that selection persist while editing filter criteria.
As you indicate there is no way to make this happen, so I am now down the dark road of "faking" the user out. I already have a class that derives from xamDataGrid and have already taken ownership of the binding between target and source to meet other client requests. With that in place, I was able to capture the events that signal the filter criteria value editors are going into edit mode, using this I can prevent the binding from being updated. So, although the grid no longer has a selected record, the source (ViewModel) still has a selected item. All that is left is highlighting the row that was previously selected while in filter edit mode, so that it still appears selected.
Don't have it perfect yet, but it is close. I appreciate your checking in. I was hoping I had missed something.
Hey azenker,
This is a very interesting situation that you have come across. There is no way around not getting the activeRecord to change when you click inside the filter row. So, having a direct binding on the active record will always cause this to happen.
However, I think I may have a relatively simple solution for you. Instead of Binding directly to the ActiveRecord to trigger changes in your other views, you can handle this by other means on the UI like a checkbox or radio button in the row. When I click the radio/check button, a trigger can give a visual active indication for the record and then via check changed event or custom command, you can change your activeDataItem in your ViewModel. So, now, you can change the active record all you want, and not have to worry about it. Just re template the DataRecordPresenter to not trigger on active or selected states and you should be good to go.
I hope I was able to get back to you quick enough on this matter. Let me know what you think. If you would like to take this idea further, please let me know.