Original: WPF notes (2.5 Canvas)--layout
Canvas is the most accurate layout container-absolute positioning, this book author is not recommended to use, the size of the control is generally with the internal font image dynamic generation and automatically change, so the use of the first three layouts is the best choice, at this point, I also hold the same opinion.
Canvas uses the Top/bottom property to control the height of the top/bottom of the distance, and the Left/right property to control the distance left/right. Interestingly, by resizing the form, the position of the second TextBlock changes, but the distance from the bottom and right is constant, and the code is shown below:
<Canvas Background="Yellow">
<TextBlock Canvas.Left="Ten"Canvas.Top=" -">Hello</TextBlock>
<TextBlock canvas.right="Ten"Canvas.bottom=" -"> World!</TextBlock>
</Canvas>
In addition, canvas does not automatically cut content beyond its own range, meaning that the extra content appears outside of the canvas because the default cliptobounds= "False", and if set cliptobounds= "True", more content will be cropped.
Finally, using Viewbox together can make the automatic layout control resizable (see next section).
WPF notes (2.5 Canvas)--layout