Self-contained multiplatform samples to help understanding: ReactiveX, ReactiveUI, Avalonia UI. Featuring links to original reference material for each fresh chunk of code, e.g.
// https://reactiveui.net/docs/handbook/events/#how-do-i-convert-my-own-c-events-into-observables
Observable
.FromEventPattern(wndMain, nameof(wndMain.Closing))
.Subscribe(_ => Console.WriteLine("Main window closing..."))
.DisposeWith(disposables);