Data binding in passive view approach

816 Views Asked by At

As it mentioned in "Build your own CAB" blog post series when you are rolling on Passive View design pattern it's not possible to take advantages of Data Binding. It is not so clear for me as I want it be. So, could any one of you guys show any samples where Data Binding is possible in Supervising Controller pattern and analogue of this sample in Passive View? Let say it is .NET 4 WinForms app.

Thanks in advance!

4

There are 4 best solutions below

0
On

Here another answer to downvote :)

MVC is all about decoupling, When updating through the View the Controller updates the Model

Databinding normally tightly couples this, updating through the View will update the binded Model

So if you want to follow the MVC pattern to the letter, you can't use normal databinding. Maybe there is some hybrid approach to do this but it will probably add more complexity then just do databinding OR MVC and will be only usable on an academic level then instead for real world programming

2
On

Why are you reading a 5 year old blog post series? Why are you using words like Supervising Controller and Passive View?

Just look for a simple example of the MVC/MVP pattern for winforms and .NET 3.5/4.0

and I repeat "SIMPLE" (as in not a lets-create-a-generic-overdesigned-framework)

0
On

Have a look at Reactive UI. Not specifically WPF/Silverlight, and should port reasonably well to the Winforms world.

http://blog.paulbetts.org/index.php/2012/04/23/announcing-reactiveui-3-1/

6
On

Give .NET 4/WPF/Caliburn.Micro combo a try...

The examples on the project pages should give you a nice intro into the view model first and convention based binding. In a nutshell it goes something like this:

  • In your ViewModel class named MyViewModel define a public property:
    public string FirstName {get;set;}
  • In your xaml View named MyView.xaml define a TextBox:
    <TextBox x:Name="FirstName" />

That's all it takes really.