DeckWorkspace within a TabWorkspace?

Topics: CAB & Smart Client Software Factory
Jul 19, 2006 at 2:52 PM
originally posted by: MJMaster

I am trying to get a DeckWorkspace working within a TabWorkspace and cannot get more than a single view to display. I have a Layout view that contains the DeckWorkspace and by debugging I can see that both views are loaded, but I can never get more than the first view to display within the contained DeckWorkspace.

Has anybody tried this or have any hints/ideas?

Thanks in advance...
Jul 19, 2006 at 11:36 PM
originally posted by: DapinderSingh

Try this :

STEP 1
Create a DeckworkSpace as _deckWorkspace and add it initially in the workitem at load time using :

InjectionConstructor
public Layout(WorkItem workItem, IWorkItemTypeCatalogService workItemTypeCatalog)
:this()
{
workItem.Items.Add(_deckWkspcTeller, "TellerDeckWorkSpace");
}

STEP 2

In the ModuleController (if u are using SCSF) of the same module, in AddView() function, add the following code
WorkItem.Items.AddNew<Teller>("TellerView");
WorkItem.Items.AddNew<CustomerInfo>("CustomerInfo");
where <TellerView> and <CutomerInfo> are my user controls which i want to load on the deckworkspace

STEP 3
Now on the function click where you want to show <TellerView> control, add the following code:

DeckWorkspace _deckWorkSpace = (DeckWorkspace)WorkItem.Workspaces "TellerDeckWorkSpace";

SmartPartInfo _SPInfo = new ZoneSmartPartInfo("TellerView");
object _smartPart = WorkItem.Items.Get<Teller>("TellerView");
_SPInfo.Dock = DockStyle.Fill;
deckWorkSpace.Show(smartPart, _SPInfo);

STEP 4
In the function call when you want to display <CustomerInfo>("CustomerInfo"), do the following code

DeckWorkspace _deckWorkSpace = (DeckWorkspace)WorkItem.Workspaces"TellerDeckWorkSpace";

SmartPartInfo _SPInfo = new SmartPartInfo("CustomerInfo");
_SPInfo.Dock = DockStyle.Fill;
object _smartPart = WorkItem.Items.Get<Module2.CustomerInfo>("CustomerInfo");
deckWorkSpace.Show(smartPart, _SPInfo);

Do not hide any of the control, always the active control will be displayed.

This works perfectly fine for me. Please tell me in case this works (or dosen't :-) )