Binding to Nested Properties

Generally, when creating a binding, you'll be binding to a single property on the source object. For example, the DataContext property of a TextBox control might be assigned a Person object, and you might want to bind to the FirstName property on that object, with the FirstName property returning a string:

<TextBox Text="{Binding FirstName, Source={StaticResource personResource}}" />

However, what if the Person object doesn't have a FirstName property but instead has a Name property that returns a PersonName object, and it's this object that has the FirstName property, meaning that you're effectively dealing with nested properties? How do you handle that sort of binding? This is possible by using the same style ...

Get Pro Business Applications with Silverlight 5 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.