ReactiveUI guidelines recommend using WhenActivated to control the lifecycle of a ViewModel.
Let's prefer it over bare metal IDisposables.
WhenActivated is a way to track disposables. Besides that, it can be used to defer the setup of a ViewModel until it's truly required. WhenActivated also gives us an ability to start or stop reacting to hot observables, like a background task that periodically pings a network endpoint or an observable updating users current location.
ReactiveUI guidelines recommend using
WhenActivated
to control the lifecycle of a ViewModel. Let's prefer it over bare metalIDisposable
s.Docs: https://reactiveui.net/docs/handbook/when-activated/ https://github.com/AvaloniaUI/Avalonia/pull/1951