Reactive UI clearly helps to write cleaner and more intuitive code, you just have to get used to bindings and thinking about Observables. There’s a lot of information and projects about Reactive UI but i didn’t find any project/tutorial showing a “complete” build just stubs or code excerptions.
So here’s my attempt to do it: https://github.com/kondaskondas/FirstsStepsRUI
This repository covers the basics; setting up the bootstrapper, bindings and routing. The demo just takes a username and password and has a side menu to change views.
- Don’t forget to include System, System.Linq, System.Reactive.Linq and ReactiveUI namespaces to get all the extensions methods.
- Use WhenAny for tracking changes of a property and WhenAnyValues to check and validate multiple properties
- ReactiveCommand.CreateAsyncTask (And other Create functions) are only to hook the tasks to do (calling functions), do result validation, business logic, UI operations, etc. always on Subscribe(…).
- If you’re updating UI from a Observable(Commands, Events, etc) do it on the Reactive MainThreadScheduler : ObserveOn(RxApp.MainThreadScheduler).Subscribe(…)
- If the solution doesn’t looks simple, you are over thinking it or taking the wrong approach (Think with Observables or don’t).
LiveTemplates, they really save time for boilerplate (IViewFor, property + backing field + NotifyPropertyChanged, etc)
Still trying to figure out if using Caliburn.Micro is a good idea, the only benefit i see is property auto-wiring when doing simple views. If anyone has a good link for using both (Caliburn.Micro and ReactiveUI) don’t hesitate to tell me!. If you see an error on the code or a better approach please write a comment.