-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Hi, I'm trying to decouple my VMs from WPF libraries and DynamicData seems to be a great way to do that. I've managed to figure out most of what I was doing before using your snippets and examples, but I've hit something I don't know how to solve.
I had two observable collections, one with all the items and another with the items selected in that collection (bound using an attached behaviour on ListView, which worked fine before). I also have a search text filter for these items, but I want to keep the selected items in the list even if they don't match the search text, so my filter method takes both of those things into account.
I have used .AutoRefreshOnObservable(_ => ...) to listen to changes to the search text using this.WhenValueChanged(...) and the selected items observable using .ToObservable(), which is updating the filter correctly, but is also deselecting all my items when it refreshes.
I found two stackoverflow questions which seemed relevant to my issue:
- Clearing on sort which you already responded to, but isn't the accepted answer (it seems like I want a move rather than remove+insert to keep the item in the selection list)
- Clearing on add which you also responded to, but
resetThreshold: int.MaxValuedidn't work for me.
I'd really like to be able to continue using this way of presenting my data to the View, but I can't if the collection clearing on changes is unavoidable, so any assistance would be appreciated, thanks.