Use of Data Binding while using Model View Presenter pattern

D

David

Does use of the model view presenter pattern negate using data binding on
controls? I believe with this pattern that the view only knows about the
presenter. By using data binding (controls on the view to data in the
model), the view would have to access the model as well.

Am I right? Should I avoid using data binding when implementing the MVP
pattern?
 
B

Bob Powell [MVP]

Don't confuse MVP with MVC. The presenter is often the ideal target for
databinding.

Remember that the presentation system may not necessarily be the UI. For
example, take the idea of a bank account with a positive or negative
balance. The number representing the balance may be a floating point value
that has no notion of colour yet, when viewed in the UI, the number will be
black or red depending on the sign. The presenter might provide a colour
property that changes with the sign of the balance and which is databound to
the ForeColor of the textbox used to display the number.

I personally believe that data-binding is the single most important
technology in the developer's toolbox today. Just consider the change to WPF
for example. Almost every aspect of application development has changed from
the Windows Forms model _except_ databinding which has been made more
robust, performant and powerful.


The short answer is "Yes, by all means use databinding between the presenter
and the view. Its the best method!"

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top