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

Concepts of custom dependency properties

From the course: Microsoft XAML: 2 Content and Properties

Start my 1-month free trial

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…

Contents