Replies: 1 comment
-
I managed to do it by creating multiple Observable and a new property composed of a Tuple of the values of all others. Some ObservableForProperty that subscribes to each one of my property and modify the new property by setting the current value in the tuple, and null for the others. Then the filter use another Observable with WhenAnyValue on that Tuple. It works, but it seems bad design. There's probably a better way to chain the original WhenAnyValue observable up without having to create new ones. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So I'm using a DynamicData SourceCache on which I Connect(), Filter() and Bind() to an ObservableCollection. I want to modify the Filter based on view model property changes.
Here's a simplified sample that works properly:
My issue comes when I want the Filter logic to be different based on which property was the last to update. Example:
I checked WhenAny instead of WhenAnyValue, since the selector offers an IObservedChange instead of the direct value, and I thought the "Expression" property would tell me which one, but no doesn't seems to be the case.
I think I could dispose and re-create the binding subscription completely instead of just adapting the filter, but that doesn't seems like a good idea.
If you require a bit more of a "real world" explanation on why I try to do that, let me explain my use case. I have a huge list of item, and I want to present those that match the last thing that was selected in the interface. So if the user click on a folder, the "SelectedFolder" property change, and I want to filter to show only the items part of that folder. If the user click on a marker on the map widget, the "SelectedMapMarker" property change and I want to display the items part of the cluster marker that was clicked on.
Beta Was this translation helpful? Give feedback.
All reactions