Using Types from Other Namespaces

So far, you've seen how to create a basic user interface in XAML using the classes that are a 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 there are a number of scenarios where it makes sense. 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 ...

Get Pro WPF in C# 2008: Windows Presentation Foundation with .NET 3.5, Second Edition 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.