Click here to Skip to main content
15,878,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do we bind a complexe data like Hierarchical data type in MVP Design pattern?
Many articles on net only shows binding of simple data type like. bool, int, string, IList<string> ... but If we need to bind a Hierarchical data model, how to achieve this?

For Example.

A Folder Structure : In WinForm can be mapped to TreeView Control.

What is the best data type that the IView must have to represent this and How will it update the tree view control.

What functionality(methods) Presenter will have both in terms of updateing View and Model.

will it have any logic for directly mapping model data to TreeView control this will again tightly bind Presenter with View as Presenter will have knowledge of view Control which is being used to display data

And also TreeView control is associated with WinForm, what if someone uses Custom/Third Party control? there might not be any "Nodes" to deal with!!!
Posted
Updated 9-Sep-12 20:17pm
v3
Comments
michaelvdnest 6-Sep-12 7:08am    
Maybe this will help.

1 solution

 
Share this answer
 
Comments
asmprogs 10-Sep-12 13:07pm    
Thank you for providing those links.. it helped in gaining knowledge.

I am looking out for MVP pattern to capture complex data.
Kuthuparakkal 10-Sep-12 13:56pm    
Try:
http://www.codeproject.com/Articles/16850/Model-GUI-Logic-using-MVP-Pub-Sub-State-Pattern-an

http://www.c-sharpcorner.com/uploadfile/john_charles/model-view-presenter-mvp-design-pattern-and-data-binding/
asmprogs 11-Sep-12 6:25am    
Thanks again...

Yes, I guess when we say binding - and class this function inside View it means.. View is in control of it.. It somewhat clear's the picture as where the binding functionality should exist.

I think in MVP if we have simple data it works like magic, but when we introduce Complex data we need to have all helper class (which might not be resulable due to tight binding to controls which they have to work with) inside View. To make presenter testable.

It can be possible if we provide an Interface which the control must provide such as Bind to which we call directly and bind data analogous to Data.Bind();

Thanks a lot for providing those links.
Kuthuparakkal 11-Sep-12 6:28am    
np :)
asmprogs 11-Sep-12 6:28am    
I also looked into this link for more information.

http://www.codeproject.com/Articles/7884/Data-Binding-TreeView-in-C

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900