GuOrg / Gu.Reactive

Helpers for using System.Reactive with INotifyPropertyChanged and INotifyCollectionChanged
MIT License
22 stars 6 forks source link

BindableBehaviourSubject #86

Closed sa-he closed 4 years ago

sa-he commented 4 years ago

Are you interested in a PR for my BindableBehaviourSubject? It provides a read/write property 'Value' that calls OnNext it's setter. Using it, I can create a XAML binding for the view and work with observables in the ViewModel.

https://gist.github.com/sa-he/09299684686251896c1747e27f855e34

JohanLarsson commented 4 years ago

Hmm, I don't see a huge need for it as the idea behind this library is to make it somewhat convenient to get observables from INotifyPropertyyChanged that said it is a nice class and I can merge it if you feel we should add it.

One weakness with using for example ObserveValue() in this lib there is always a race condition as the property may have been set again by some other thread. Normally this is not much of an issue.

Your class does not have this problem.

sa-he commented 4 years ago

Sorry, I was not aware the concept of this lib is one-way from INPC to RX. Unless you extend the concept I wouldn't include BindableBehaviourSubject .

JohanLarsson commented 4 years ago

It is not set in stone but the reason it was created was to provide convenience when using RX with INPC.