reactivemarbles / DynamicData

Reactive collections based on Rx.Net
http://dynamic-data.org
MIT License
1.71k stars 182 forks source link

BindableDerivedListAttribute with a .BindEx( this, x => x.MyDerivedList) extension method #348

Closed ChaseFlorell closed 2 years ago

ChaseFlorell commented 4 years ago

Is your feature request related to a problem? Please describe.

I'm a huge fan of leveraging the Rx Fody attributes in order to make my app clean and terse. One area That I'd love to see further improvement is around derived lists. Currently my derived list code looks like this.

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

private ReadOnlyObservableCollection<Person> _visiblePeople;
public ReadOnlyObservableCollection<Person> VisiblePeople => _visiblePeople;

Describe the solution you'd like

What I'd love to be able to do is clean it up and remove the backing field

ctor()
{
    this.WhenAnyValue(vm => vm.People)
        .Subscribe(people => people
            .ToObservableChangeSet()
            .AutoRefresh(x => x.Deleted)
            .Filter(x => !x.Deleted)
            .BindEx(this, x => x.VisiblePeople)
            .Subscribe());
}

public ReadOnlyObservableCollection<Person> VisiblePeople { [BindableDerivedList] get; };

Describe alternatives you've considered

Describe suggestions on how to achieve the feature

Additional context

This would very much be akin to the existing ObservableAsPropertyAttribute

open-collective-bot[bot] commented 4 years ago

Hey @ChaseFlorell :wave:,

Thank you for contributing to our project financially. We will handle your issue with priority support. To make sure we don't forget how special you are, we added a priority label to your issue.

Thank you again for contributing :tada:!

ChaseFlorell commented 4 years ago

Also, if I'm just missing something that's already there, then my suggestion would be to improve the documentation as this is all I'm able to go off of. https://reactiveui.net/docs/handbook/collections/

Collections
RLittlesII commented 4 years ago

@ChaseFlorell Is this more of a request for DynamicData?

ChaseFlorell commented 4 years ago

@RLittlesII ultimately it's a request for the ReactiveUI.Fody bits.

glennawatson commented 4 years ago

User wants a fody for dynamic data.

RLittlesII commented 4 years ago

@ChaseFlorell I think this is doable. We have some work coming up soon around Fody. So we can evaluate this when we target that work.

RolandPheasant commented 2 years ago

I am not sure what is required? Is it still relevant? If so please reopen and let's discuss further.

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.