views:

200

answers:

4

Im tring to make a composite application (i am still learning how it all works)

Lets say there are two regions with a view in each that interact with each other via drag and drop, view A contains a list of tasks that view b (which contains a list of People) doesnt really know about.

When I select some tasks in the list from view a and drop it to another list maintained by view b which module should know what happened? does the module that maintains the tasks need to know about the module that maintains the people, or vise vera? where should I start? any clarity on the whole interaction and how its best handled would be greatly appresiated

thanks

+1  A: 

It depends on what your architecture is. If you are using WPF, I suggest you look at the MVVM pattern. Here is a great intro. video on that. If you are using Winforms, I suggest you look at the Smart Client Software Factory. Also, Patterns & Practices has put together a very nice Application Architecture guide it's fairly comprehensive and free -- worth a look.

JP Alioto
+1  A: 

The regions contain views which are bound to ViewModels. When starting to drag, create an adorner that represents the data visually, but in the drag drop logic, set the drag source data to be a collection of the data itself, for instance, tasks. The drag target VM can then see (both when dropping AND when the mouse moves during a drag-drop operation) whether or not it'll allow the drop based on the types contained in the collection.

Steve Dunn
Thanks, this seems to be a start, do you know of any examples that still maintains the seperation of each module, i wouldnt mind to make the task object infrastructure (if thats the accepted way to do this)
almog.ori
A: 

YMMV but I'd create an event that is triggered from the source (task list) and has a delegate handler in the target (people).

Mark

Mark Cooper