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

Support for DynamicData #77

Open
martinbu opened this issue Oct 14, 2024 · 2 comments
Open

Support for DynamicData #77

martinbu opened this issue Oct 14, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@martinbu
Copy link

I already started a discussion here some time ago. reactiveui/ReactiveUI#3691

The question was if an attribute for DynamicData's .Bind and ReadOnlyObservableCollection could be added too. The original question was asked here: reactivemarbles/DynamicData#348

The reply of @glennawatson was, that this would be something for source generators. Therefore, I want to bring this on the table in this repository.

@ChrisPulman
Copy link
Member

I will take a look at what would be required to achieve this
My understanding is that you wish to be able to turn this.

private ReadOnlyObservableCollection<Person> _visiblePeople;

ctor()
{
    this.WhenAnyValue(vm => vm.People)
        .Subscribe(people => people
            .ToObservableChangeSet()
            .AutoRefresh(x => x.Deleteed)
            .Filter(x => !x.Deleted)
            .Bind(out _visiblePeople)
            .Subscribe());
}

public ReadOnlyObservableCollection<Person> VisiblePeople => _visiblePeople;

Into this

[BindableDerivedList]
private ReadOnlyObservableCollection<Person> _visiblePeople;

ctor()
{
    this.WhenAnyValue(vm => vm.People)
        .Subscribe(people => people
            .ToObservableChangeSet()
            .AutoRefresh(x => x.Deleteed)
            .Filter(x => !x.Deleted)
            .Bind(out _visiblePeople)
            .Subscribe());
}

Which will then generate

public ReadOnlyObservableCollection<Person> VisiblePeople => _visiblePeople;

@ChrisPulman ChrisPulman added the enhancement New feature or request label Oct 18, 2024
@martinbu
Copy link
Author

Yes exactly! Thank you for looking into this.

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

No branches or pull requests

2 participants