Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

16. WPF Controls > The Dock Panel

The Dock Panel

By default, Visual Studio sets up a new window with a Grid as the layout root. I almost always change that to a DockPanel, which seems to me perfectly suited to the conventional layout of any window, with a menu bar and a toolbar at the top, a status bar at the bottom, and a client area filling the remaining space.

image
image

How’d You Do?

image

image


Put on Your Thinking Hat

image

It’s probably obvious by now how you can use the Dock attached property to arrange the children of a DockPanel, but look carefully at the example below. The TextBox at the very top runs all the way to the edges of the panel, but the TextBox at the bottom is interrupted by the Rectangle at the left.

Try building the window in Visual Studio. Can you work out what controls how the child elements are stacked?


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint