I'm afraid that the time to write such a sample code with explanations is a lot of work, because that there are a lot of things involved beyond docking, such as resizing, dragging, positioning and what not, and there are some good articles around, I advise
you to read about it, here are few articles.
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.