From the course: Microsoft XAML: 2 Content and Properties
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Concepts of custom dependency properties
From the course: Microsoft XAML: 2 Content and Properties
Concepts of custom dependency properties
- [Instructor] Most properties, on WPF elements, are dependency properties. When you create your own elements, you should follow this same pattern, and create custom dependency properties. In this chapter, I'll give an overview of custom dependency properties. This a big topic. You should look into it further. Let's review. The dependency property system exists to provide services for your xaml elements. For example, there are services like animation, data binding, control templates, and styles. Your elements can also partake in these services. If you were to implement your control properties only as .net properties, then, sooner or later, you will discover that you have created a UI element that cannot be animated or styled. And, that would be a tragedy. To participate, and create a dependency property, you have to register with a dependency property system. That means, you have to write what I call 'ugly' registration code. You'll see what I mean about this ugliness in a few…
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
-
-
-
-
(Locked)
The trouble with normal .NET properties for UI7m 56s
-
(Locked)
Explore the concept of dependency properties4m 33s
-
Use some dependency properties4m 53s
-
(Locked)
Order of precedence for dependency properties8m 56s
-
(Locked)
Explore the concept of attached properties4m 35s
-
(Locked)
Attached properties with the grid3m
-
(Locked)
Attached properties with the canvas3m 36s
-
(Locked)
Concepts of custom dependency properties3m 10s
-
(Locked)
Register the custom dependency property3m 20s
-
(Locked)
Use the custom dependency properties2m 1s
-
(Locked)
-