1

In many ways I think of using the MVC pattern in WinForms, but I'd like to know if it's possible to bind controls with objects using the ObservableCollection type? If it's purely for WPF, what other alternatives are out there?

To put it into perspective, we're building a system which has business logic that I'd like to control the UI with, instead of making customizations for each requirement or workflow on the UI itself. We have around a few hundred potential forms which I'd like to start designing with the pattern in mind.

We're also building web interfaces for most of the processes, but in reality they're just watered-down versions of the Forms. If I can use the same framework which I can just bind to on the web form that would be awesome.

Thanks

Daniel Minnaar
  • 5,865
  • 5
  • 31
  • 52

1 Answers1

0

What ObservableCollection does is that it implements INotifyPropertyChange and each control in WPF has the possibility to listen for it's bound data to raise the event from INotifyPropertyChange. You can read more here about why you can't use ObservableCollection they way you want to in WinForms.

Another way is to use the Model-View-Presenter pattern:

enter image description here

This pattern can also be used in ASP.NET.

There's an MSDN Magazine Article on: "Better Web Forms with the MVP Pattern" that I think you should look into. And here is an introduction to how you use MVP-pattern in asp.net.

Community
  • 1
  • 1
Filip Ekberg
  • 36,033
  • 20
  • 126
  • 183