SmartPart not docked in WindowWorkspace?

Topics: CAB & Smart Client Software Factory
Feb 11, 2007 at 3:01 AM
Edited Feb 11, 2007 at 2:59 PM
I finally made the jump to using WindowWorkspace and I've got some problems...

I've got a couple problems, but the one that is really stopping me is that my SmartPart doesn't seem to be FILL docked to the form. EG: I show a SmartPart in a WindowWorkspace and it looks fine. I increase the size of the Window by dragging the corner and my SmartParts stays exectly the same size it was.

I can't imagine I'm the first one to find this, so there must be a setting I'm missing. Anyone have any suggestions?

Thanks,
Steve
Feb 11, 2007 at 6:37 AM
In order for a control (UserControl in this case) to fill the container it is in, it's DockStyle property must be set to "fill". By default, UserControls that we create as SmartParts don't have their DockStyle property set.

My guess is that changing the property on the UserControl would not fix it, however. I think you'd have to set such a property on a WindowSmartPartInfo object when you pass it to the Workspace for showing. And I can't recall if the default WindowSmartPartInfo object has a DockStyle property or not.

If it doesn't you can always alter the source code to do this (or send me an e-mail, I can get a solution to you).

-Chris
Feb 11, 2007 at 3:12 PM
Hey Chris!

The automatic docking behavior of the WindowWorkspace and the DeckWorkspace seems to be different. If I display my SmartPart in a DeckWorkspace, it fills the workspace as I would expect, but not the same story with the WindowWorkspace.

I added code to WindowWorkspaceExtended to set the Dock property. I just though it was strange that the other workspaces default to this behavior but the WW doesn't.

Have a good one,
Steve
Feb 11, 2007 at 6:01 PM
Steve,

I'm sure that the DockStyle property of the WindowWorkspace got overlooked because the WindowWorkspace sizes itself to fit your UserControl when it opens. And if the WindowWorkspace sizes itself to the correct dimensions when it opens the UserControl, then it probably never occured to someone to support the instance where a user resizes the Window containing the UserControl.

Most of the time when people open a dialog box for something they never have to resize it if it's the correct size on opening (of course Visual Studio being the exception... Whose idea was it to make the column editor dialog for DataGridViews so small? hehe)


Feb 11, 2007 at 6:04 PM

Whose idea was it to make the column editor dialog for DataGridViews so small? hehe)

No kidding!

Luckily setting the Dock property of the SmartPart is a simple task.

It's nice to see some activity on the forum, thanks for helping me out.
Enjoy the rest of your weekend,
Steve