Re: [TFUI] Model-View-Presenter with complex controls.

"moravich" <[email protected]> Wed, 21 Sep 2005 10:29:57 -0000
Newsgroups gmane.comp.programming.test-first-user-interfaces
Message-ID <[email protected]>
> Why not create a TreeView control that is capable of binding to your 
> model? I've extended the MS controls before with decent success. I
can't 
> imagine it would be all that hard to write a wrapper that does the 
> binding you would normally do in the view, but as a user control. You 
> can test it seperately, then treat it as a black box in your view.
> 
> Cory

Thank you for the reply.

I've thought of that approach. I've read a few articles on MSDN and on
the Code Project that prove that it is possible. 

The problem I saw with this approach was that I couldn't see clear way
to do the binding of hierarchical data without sacrificing reusability
of the control or imposing restrictions on the data. I guess I am
always looking for the magic bullet.

All the examples I saw used the .Net binding strategy of binding to a
type that implements IList or IListSource or IBindingList and then
doing some group to the data based on some properties. This works fine
but imposes a restriction on my model.

Then there is the possibility of having the model classes extend
TreeNode, which is not sealed, and have true hierarchical data. But
this would create bloated model classes with a lot of properties that
shouldn't be there.

There is another way I could do it, that I though when writing this
post. Instead of having the Presenter directly change the TreeNode
property of the View, I could refactor that code to a generic
adapter/strategy pattern and extract some interface from the resulting
code and extend the TreeView control to bind to that code. I guess
this would become apparent when I saw the repetition on different
Presenters if I followed the path I was going to follow in the first
place.

Artur





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

To unsubscribe, email:
TestFirstUserInterfaces-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/TestFirstUserInterfaces/

<*> To unsubscribe from this group, send an email to:
    TestFirstUserInterfaces-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/