Print Page | Close Window

Screen composition in cocktail

Printed From: IdeaBlade
Category: Cocktail
Forum Name: Community Forum
Forum Discription: A professional application framework using Caliburn.Micro and DevForce
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3420
Printed Date: 23-Aug-2025 at 12:26am


Topic: Screen composition in cocktail
Posted By: JohnBloom
Subject: Screen composition in cocktail
Date 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



Replies:
Posted By: mgood
Date 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.



Print Page | Close Window