Skip to content

Why can't I filter my data? #700

Closed Answered by bombizombi
kyuranger asked this question in Q&A
Discussion options

You must be logged in to vote

You connected to your source multiple times, and they all Bind to the same ObservableCollection. So, if you pressed all 3 buttons, your ListBox contains 3 filtered lists and also the original unfiltered list all bunched together.

You could use the Filter operator right from the start. It even accepts an IObservable of filter, so you can just push a new filter down its pipe, like this:

public partial class MainWindow : Window
 {
     public MainWindow()
     {
         InitializeComponent();
         for (int i = 0; i <= 100; i++)
         {
             SourceList.Add(i.ToString());
         }
         SourceList
             .Connect()
             .Filter(_filter)
             .Bind(thi…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kyuranger
Comment options

Answer selected by kyuranger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants