What is the accepted / best method for sorting / filtering an ObervableCollection in Community Toolkit MVVM? #18038
Replies: 1 comment 2 replies
-
DynamicData is technically separate from ReactiveUI (though it's used by and maintained by their team, in part). You can import the However, ReactiveUI has some nice extensions that you may need. I'm not sure how easily these can be included in your app without also taking a dependency on ReactiveUI. Even if you do, you can use Mvvm Toolkit + ReactiveUI side-by-side if you're careful about it. This is what I've done in the past, but the extra dependency didn't really matter. An alternative is ObservableCollections + R3 which should also be usable with Mvvm Toolkit. It's a much newer framework so I can't really tested it yet. They have an Avalonia sample at https://github.com/Cysharp/ObservableCollections/blob/6f5de33bff1cad05b3ad4ff56583ad4919ba9f9c/sandbox/AvaloniaApp/MainWindow.axaml.cs |
Beta Was this translation helpful? Give feedback.
-
Hi,
im wanted to ask about this because i ran out of ideas at this point
A have a ObservableCollection with about 300 UserControls that need sorting and filtering based on their DataContext properties.
And is displayed in a ItemsControl.
Right now im using the method of sorting / filtering in a list and then use that to toggle visibility and move items in the observable collection. While this works, it is slow and it is starting to become difficult to add more options and maintain.
I tried with this, but it dosent work. Probably because im not using ReactiveUI. Im using Community MVVM with compiled bindings.
https://docs.avaloniaui.net/docs/concepts/reactiveui/binding-to-sorted-filtered-list
Beta Was this translation helpful? Give feedback.
All reactions