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.
Explore the concept of attached properties
From the course: Microsoft XAML: 2 Content and Properties
Explore the concept of attached properties
- [Instructor] Attached properties are another innovation that came from the WPF team and continues in the other XAML frameworks. One way to think of an attached property is that it's a global property. It's defined in one type, but is settable in other WPF types. I'll show some examples to clarify the concept. In this first example, I have a button element in my XAML. Each property shown here is a dependency property defined in the button class or one of it's base classes. There's no problem using them, they'll work as expected because they are part of the button object members. In this second example, I tried to use properties defined on another class. In this case, the window class. Since these properties are not part of the button object object model, Visual Studio shows a blue warning squiggle. If I tried to run the application, I'll get an error. This makes sense doesn't it? I shouldn't be able to use the properties. The button doesn't know what to do with them. Here's an…
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)
-