2.4. Using Types from Other Namespaces

So far, you've seen how to create a basic user interface in XAML using the classes that are part of WPF. However, XAML is designed as an all-purpose way to instantiate .NET objects, including ones that are in other non-WPF namespaces and those you create yourself.

It might seem odd to consider creating objects that aren't designed for onscreen display in a XAML window, but it makes sense in a number of scenarios. One example is when you use data binding and you want to draw information from another object to display in a control. Another example is if you want to set the property of a WPF object using a non-WPF object.

For example, you can fill a WPF ListBox with data objects. The ListBox will call the ...

Get Pro WPF in C# 2010: Windows Presentation Foundation in .NET 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.