ReactiveUI in simple User Controls ?

Skip to first unread message

Fares Eidi

Aug 14, 2015, 12:35:52 PM8/14/15
to ReactiveUI mailing list
Is it possible / recommended to make use of a user control ?  in my case I just have a simple user control composing a few other standard controls (textboxes, buttons etc), and I am doing some UI logic in the code behind.

The reason I'd like upgrade this design to make user of ReactiveUI, is that I imagine declarative usage of the this.WhenAnyValue() will really simplify handling  / managing button clicks / disabling controls etc... and really beats writing event handlers in code behind.

I am using reactiveui in my normal view models, but in my user controls i've decided against usage of view models after reading this post  (will's answer), since it explains how creating a ViewModel for UserControls, would break the natural flow of data via the DataContext.

Any guidance much appreciated

Fares Eidi

Aug 14, 2015, 12:43:26 PM8/14/15
to ReactiveUI mailing list
I wasn't clear, I meant Is it possible  to make use of reactiveUI in the code behind of a user control.....

Matt Oswald

Aug 15, 2015, 12:51:10 AM8/15/15
to ReactiveUI mailing list
There's nothing wrong with doing it that way. I do it all the time. ReactiveObject, this.WhenAnyValue, etc are all great tools to have at your disposal.

To make it even more clear, I don't agree with Will's answer at all. I'm definitely on James B's side in the comments talking about making your UI testable through VMs. I write testable VMs for all but the simplest of UserControls. The only things I don't give ViewModels are CustomControls.


Fares Eidi

Aug 15, 2015, 5:42:55 PM8/15/15
​Thanks Matt, I will try it to write a seperate view model,

Just to be sure, it is not possible to use the reactiveui directly in the code behind, because that class directly inherits already from usercontrol and so it won't be possible to derive from reactiveobject,
Correct ?

Envoyé depuis mon smartphone Sony Xperia™ via le réseau SFR

You received this message because you are subscribed to a topic in the Google Groups "ReactiveUI mailing list" group.
To unsubscribe from this topic, visit
To unsubscribe from this group and all its topics, send an email to
For more options, visit

Reply all
Reply to author
0 new messages