Using Arbitrary Types in XAML
Thanks to XAML’s general-purpose nature, you can use it with just about any .NET object, C++/CX objects in a C++ app targeting the Windows Runtime, or even COM objects in a WPF app, thanks to COM interoperability. This includes types you define yourself.
It doesn’t matter whether these objects have anything to do with a user interface. However, the objects need to be designed in a “declarative-friendly” way. For example, if a class doesn’t have a default constructor and doesn’t expose useful instance properties, it’s usually not going to be directly usable from XAML. A lot of care went into the design of the XAML-based frameworks—above and beyond the usual .NET or Windows Runtime design guidelines—in order to fit ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access