New Posts New Posts RSS Feed: Screen composition in cocktail
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Screen composition in cocktail

 Post Reply Post Reply
Author
JohnBloom View Drop Down
Groupie
Groupie
Avatar

Joined: 30-Nov-2010
Location: Topeka, KS
Posts: 95
Post Options Post Options   Quote JohnBloom Quote  Post ReplyReply Direct Link To This Post Topic: Screen composition in cocktail
    Posted: 02-May-2012 at 12:32pm
Ok so I need a little help in the screen composition area of cocktail. For our massive data entry screen we have about 16 separate sections that are their own view. What we currently do now is create a conductor for each of the views and bind a content control to the active item of the conductor. I understand that this might not be the correct way to do things but it worked. 

It appears that in the temphire app you have an individual property for the viewmodel and bind to that. That works as well but you also have to manage the activating and deactivating of each view. Also that would be a huge constructor to bring in 16 vms. If I was looking to clean up this screen should I follow your approach or is there perhaps a third way that would handle our scenario?
-John Bloom
Back to Top
mgood View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 18-Nov-2010
Location: Emeryville, CA
Posts: 583
Post Options Post Options   Quote mgood Quote  Post ReplyReply Direct Link To This Post Posted: 02-May-2012 at 2:45pm
The third way is how it's done in StaffingResourceContactInfoViewModel. It uses Conductor<T>.Collection.AllActive. You'll still have to activate each VM once, but from that point on the conductor manages deactivation and potential reactivation automatically. You can then either bind to the Items collection and layout the 16 views in an ItemsControl, TabControl etc. or if you need to access them individually than you add properties on top of the Items collection that pulls out know VMs.
 
To reduce the constructor those 16 VMs can implement an interface by which they are exported and do an ImportMany. You can see that done in StaffingResourceDetailViewModel. It imports IEnumerable<IStaffingResourceDetailSection> and each one automatically becomes a tab. I can add new tabs without having to touch the DetailViewModel at all. Just add another VM that implements IStaffingResourceDetailSection.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down