2

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!

kseen
  • 359
  • 8
  • 56
  • 104

4 Answers4

0

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

David DV
  • 674
  • 4
  • 9
0

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.

jl.
  • 752
  • 6
  • 19
  • Is there another similar approach to that but related to WinForms? I just thought about framework and decide that I can't go through with WPF, only with WinForms. – kseen Apr 25 '12 at 02:58
  • 1
    I didn't do a WinForms based data bound application... sorry – jl. May 03 '12 at 12:34
  • What is your app's domain and area of usage? – kseen May 03 '12 at 14:09
  • I've used WPF for business apps if that's your question. – jl. May 03 '12 at 17:09
  • the way I take it the apps that are more or less data centric and support some business process. not too much graphics. that's just my take on it though. you'd probably be able to find a couple of definitions in a second... but this is a bit off topic, isn't it? – jl. May 03 '12 at 17:46
  • Agreed with you. Could you please email me. I just wondering about your combo and I would like to just discover how this combo may used in any projects. – kseen May 03 '12 at 17:55
0

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/

pms1969
  • 3,354
  • 1
  • 25
  • 34
-2

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)

David DV
  • 674
  • 4
  • 9
  • 1
    Because those patterns are a lot older and not every innovation is an improvement? – Stephan Eggermont Apr 20 '12 at 10:40
  • 1
    With 5 years old I was talking about C# not even having Linq at that time, so not looking at the code for that blog-series, there will probably be a better way to do this in the current version of C# – David DV Apr 22 '12 at 22:22