I am trying to make my own user control and have almost finished it, just trying to add some polish. I would like the option in the designer to "Dock in parent container". Does anyone know how to do this I can't find an example. I think it has something to do with a Docking Attribute.
I would also suggest looking at the DockingAttribute.
[Docking(DockingBehavior.Ask)]
public class MyControl : UserControl
{
public MyControl() { }
}
This also displays the 'action arrow' on the upper right corner of the control.
This option is available as far back as .NET 2.0, and it is far simpler if all you're looking for is the 'Dock/Undock in Parent Container' function. The Designer classes are massive overkill in that case.
It also gives the options of DockingBehavior.Never
and DockingBehavior.AutoDock
. Never
does not display the arrow and loads the new control at it's default Dock
behavior, while AutoDock
displays the arrow but automatically docks the control in as Fill
.
PS: Sorry about necromancing a thread. I was looking for a similar solution, and this was the first thing that popped up on Google. The Designer attributes gave me an idea, so I started digging around and found DockingAttribute, which seemed far cleaner than the accepted solution with the same requested results. Hopefully this will help someone in the future.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With