From the course: Microsoft XAML: 2 Content and Properties
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Attached properties with the canvas
From the course: Microsoft XAML: 2 Content and Properties
Attached properties with the canvas
- [Instructor] In this demonstration, I'll show the attached property for the canvas class. The UI that I have is a canvas element on Line 12 that contains two ellipses. A canvas is used for absolute positioning of elements and, in my case, I've got this orange ellipse and I've got the lavender ellipse. And they're both in the upper left hand corner. The reason why the orange ellipse is in the upper left hand corner is because I put it there, canvas.left equals zero and canvas.top equals zero. The reason why the lavender ellipses is there is because that's the default position. I didn't provide a canvas.top property or a canvas.left, so it's in the same position. I'll change that by using canvas.left equal 200. And that moves it 200 pixels from the left side of the ellipse. They're pretty self explanatory. If I use the right property, canvas.right, it moves it 200 pixels from the right side of the canvas. And there's also top and bottom. It's pretty straightforward. Works the way all…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
The trouble with normal .NET properties for UI7m 56s
-
Explore the concept of dependency properties4m 33s
-
Use some dependency properties4m 53s
-
Order of precedence for dependency properties8m 56s
-
Explore the concept of attached properties4m 35s
-
Attached properties with the grid3m
-
Attached properties with the canvas3m 36s
-
Concepts of custom dependency properties3m 10s
-
Register the custom dependency property3m 20s
-
Use the custom dependency properties2m 1s
-
-