From the course: Windows Presentation Foundation: 2 Layout

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

How panels affect control size

How panels affect control size

From the course: Windows Presentation Foundation: 2 Layout

Start my 1-month free trial

How panels affect control size

- [Instructor] During the two phase layout, each child element is given an opportunity to specify its desired size, and, then, during the arrange phase, the parent element, usually a panel, tells each child what its final size is. The desired size, and the final size, may not match, depending on what the parent panel decides to do, with its children. So, that's what I want to demonstrate, here, how the parent affects the size of the child. To do that, I have three examples, on this window. I have a Canvas, here, that contains a LetterBox, where I've set the width to Auto. And, that means that the control, itself, decides what its desired width is, and its desired height is, based on its internal algorithms. In the second Canvas, I have hard coded the width of the Letterbox, to 300 pixels. As you can see, at the top of the screen, the window, itself, is 525 pixels wide, and, the Canvas is also 525 pixels wide. So, there's going to be some extra space, in the Canvas. So, what we'll look…

Contents