CommunityToolkit / CommunityToolkit/dotnet

Weak PropertyChanged on ObservableObject

Aperta
#80 3 commenti 4 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C#
Stelle
3.8k
Fork
400
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I'm currently using `ObservableObject` from `Xamarin Community Toolkit`. The implementation is very similar to the `ObservableObject` here, but one interesting difference is that `PropertyChanged` event is implemented using a weak event manager implementation.

https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/ObjectModel/ObservableObject.shared.cs

Is there any possibility of bringing a weak `PropertyChanged` version of `ObservableObject` here?

`Xamarin Community Toolkit` has its own `DelegateWeakEventManager` which would also need implementing.

https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Helpers/DelegateWeakEventManager.shared.cs

There is a conversation [here](https://github.com/dotnet/runtime/issues/61517) about bringing such a class directly into the BCL, but I would guess it would be quicker and easier to add it here (even if it becomes obsolete in the future).

As another aside, on the MAUI front, `DelegateWeakEventManager` has been promoted to the main MAUI repo. There is a discussion going on there about the possibility of depending on .NET Community Toolkit (for the main purpose of using the `IMessenger`) but if it does happen, then it could drop it's `DelegateWeakEventManager` in favour of using one here, if it gets added.

https://github.com/dotnet/maui/pull/3880

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia confrontando l'implementazione esistente di ObservableObject con ObservableObject.shared.cs e DelegateWeakEventManager.shared.cs di Xamarin Community Toolkit. Determina l'ambito dell'aggiunta di un'implementazione debole di PropertyChanged e del relativo event manager di supporto; l'issue è completa quando il comportamento di weak event richiesto è implementato e coperto dai test pertinenti del repository.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
api, tooling
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.