The Canvas Panel

Most WPF containers allow the dynamic rearrangement of controls within the user interface. This is useful when you want your user to adjust interface settings, but it can complicate things when you need to place controls in a fixed, unchangeable place (as happens in Windows Forms). To accomplish this, you use the Canvas container, which allows absolute placement, meaning that it allows specifying the position of nested controls. When you place controls into a Canvas container, you specify the absolute position with some attached properties: Canvas.Left, Canvas.Top, Canvas.Right, and Canvas.Bottom. The following code shows how you place a button that never changes its position in the user interface, thanks to the Canvas.Left

Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.