Nesting Workspaces

Feb 24, 2008 at 11:10 PM
Hi there,

probably my question already suggests that I am new to SCSF... I was playing around, trying to nest a TabWorkspace into a ZoneWorkspace. However, when trying to activate a tab, zone_GotFocus crashes because it expects its children to be a SmartPart rather than another workspace.

Am I addressing this the completely wrong way? If so, would you recommend a NestedZoneWorkspace which has a TabWorkspace child, or rather a NestedTabWorkspace which unifies those behaviours? Or am I missing the point completely here? ;-)

Thanks,

Chris
Developer
Feb 25, 2008 at 3:33 PM

ChrisMenge wrote:
Hi there,

probably my question already suggests that I am new to SCSF... I was playing around, trying to nest a TabWorkspace into a ZoneWorkspace. However, when trying to activate a tab, zone_GotFocus crashes because it expects its children to be a SmartPart rather than another workspace.

Am I addressing this the completely wrong way? If so, would you recommend a NestedZoneWorkspace which has a TabWorkspace child, or rather a NestedTabWorkspace which unifies those behaviours? Or am I missing the point completely here? ;-)

Thanks,

Chris


Workspaces are designed to house UserControls (don't let the SmartPart name fool you; they're just UserControls). So a TabWorkspace is designed to house multiple different UserControls, and a ZoneWorkspace is designed to house one UserControl.

Now here's the glue to let you get creative: A Workspace is a Control (exception: WindowWorkspace) that can be placed on a UserControl.

So, to achieve the nesting you're after, place a TabWorkspace on a UserControl. We'll call this TabUserControl. I assume you've already got a UserControl with the ZoneWorkspace on it. We'll call that the ZoneUserControl. Now you can take the TabUserControl and place it on the ZoneWorkspace. Nesting achieved.