Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about filters and implementing a search function #93

Open
GamingCity opened this issue Jan 23, 2025 · 1 comment
Open

Question about filters and implementing a search function #93

GamingCity opened this issue Jan 23, 2025 · 1 comment

Comments

@GamingCity
Copy link

GamingCity commented Jan 23, 2025

Im trying to learn how to use this lib, it seems to do what i need with filters and sort. On Avalonia UI.

After attaching a filter, you do you tell it that that the information the filter is based on has updated IF the obersable list has not changed?

let say.

[ObservableProperty]
internal string search = string.Empty;

public viewmodelconstructor()
{
      var view = list.CreateView(x => x);
      ItemsView = view.ToNotifyCollectionChanged(SynchronizationContextCollectionEventDispatcher.Current);
      view.AttachFilter(x => x.Name != null && x.Name.Contains(Search, StringComparison.CurrentCultureIgnoreCase));
}

Search is attached to the textbox and i want the displayed list to update as the user writes the search string rather than press a button.

If i use a button and attach the "AttachFilter" to a command, it will work, and i can do the same thing every time "search" string has changed, but not sure if thats the intended way of doing it.

@neuecc
Copy link
Member

neuecc commented Jan 24, 2025

Thank you.
I see, we may need something that can only notify from the outside.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants