PC Review


Reply
Thread Tools Rate Thread

Use of Data Binding while using Model View Presenter pattern

 
 
David
Guest
Posts: n/a
 
      3rd Jan 2008
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?
--
Thanks,
David.
 
Reply With Quote
 
 
 
 
Bob Powell [MVP]
Guest
Posts: n/a
 
      5th Jan 2008
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.


"David" <(E-Mail Removed)> wrote in message
news:BDA7BCD0-6C0C-47DE-9FEF-(E-Mail Removed)...
> 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?
> --
> Thanks,
> David.


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Design Patterns (Model View Presenter etc) Maximilian Microsoft Dot NET Framework Forms 2 17th May 2008 10:22 AM
Model View Presenter ? Piotr Nowak Microsoft ASP .NET 1 9th Jul 2007 12:07 PM
model view presenter examples Dan Microsoft C# .NET 1 3rd Apr 2007 02:48 PM
Model view presenter - setting object collections Doug Microsoft C# .NET 12 5th Nov 2006 05:39 AM
Unit Testing Model-View-Presenter Sean Chambers Microsoft C# .NET 10 9th Oct 2006 03:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:53 PM.