The Canvas is a basic layout panel in WPF. Its child elements are positioned by explicit coordinates, set with the Canvas.Left, Canvas.Right, Canvas.Top, and Canvas.Bottom attached properties.
- [Instructor] Use the Canvas Panel…when you want to control the absolute position…of the children elements.…In this example, I have a canvas that contains…two letter boxes.…Letter box A and letter box D.…Since I haven't specified a position for either letter box,…they're in the default position…which is the upper left hand corner of the canvas.…To change it, you use an attach property…on the canvas class, like this.…Canvas.Left, and then I put a pixel value in here.…Canvas.Left, 180.…So that moves the left edge of letter box D…180 pixels from the left edge of the canvas.…
Now I'll move it back to position 60…and you can see that one of the principles of the canvas…is that you can have children overlap.…Now to make it easier to see both elements,…both letter boxes, I set the opacity level to 70%…for both letter boxes,…which makes it semi-transparent.…So you can see letter box A behind letter box D.…Next I'll set the Canvas.Top property.…Like that.…And then I'll run the application…and show them in their current position.…
- Exploring the layout panels
- Working with the grid
- Adding rows and columns
- Creating scrolling content
- Controlling element visibility
- Aligning content
- Making custom layout panels
Skill Level Intermediate
Learning Visual Studio Team Serviceswith Jose Miguel Rady Allende1h 17m Intermediate
1. Layout Panels
2. Other Layout Concepts
3. Custom Layout Panel
Next steps1m 34s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.