Creating child workspaces

Topics: CAB & Smart Client Software Factory
Nov 26, 2007 at 4:08 PM
I have a tabbed workspace on my shell application that serves as the main area of the form.
I would like to add child workspaces to a view in one of the tabs.

I have been able to visually do this in the designer, but I having trouble setting up the hierarchy and adding the view.

Do I have to add a child workitem and then add the child workspace to that?
If so, how do I identify the workspaces I have added throught the designer?

Thanks.
Nov 26, 2007 at 5:14 PM

TCSells wrote:
I have a tabbed workspace on my shell application that serves as the main area of the form.
I would like to add child workspaces to a view in one of the tabs.

I have been able to visually do this in the designer, but I having trouble setting up the hierarchy and adding the view.

Do I have to add a child workitem and then add the child workspace to that?
If so, how do I identify the workspaces I have added throught the designer?

Thanks.


When a view has a Workspace on it, typically all that is required is to add the view to the SmartPart collection of the containing WorkItem, like so:

WorkItem.SmartParts.AddNew<MyView>("SomeStringIdentifier");

If the view has a Workspace on it, ObjectBuilder should automatically add it to the Workspaces collection. If that does not work,. you could expose the Workspace as a public property of the view and add it manually to the Workspaces collection:

IMyView view = WorkItem.SmartParts.AddNew<MyView>("SomeStringIdentifier");
Workspaces.Add(view.Workspace2);

Nov 26, 2007 at 6:57 PM
Thanks for the response, Chris.

I tried again per your information and all seems to be working.
Nov 26, 2007 at 10:00 PM

TCSells wrote:
Thanks for the response, Chris.

I tried again per your information and all seems to be working.


Glad to be of help :-)
Nov 27, 2007 at 5:58 PM
Edited Nov 27, 2007 at 6:00 PM
Hi

I recommend you to see the SmartPart QuickStart included in the Smart Client Factory Source code. In it you will be able to see how to add views containing workspaces and related them through WorkItems.

For example, the ViewCustomerWorkItem contains the CustomerTabView.cs (among other views) that has a TabWorkspace in it. This may guide you in what you seek.

Please let me know if this helps.

Ignacio Baumann Fonay
http://staff.southworks.net/blogs/ibaumann/