logeeks
logeeks

Reputation: 4979

binding using a composite property in wpf

I have a class called Person which comprises of another object 'Contact' which holds the person address. I am binding the person class to the wpf grid. How can i bind a property inside Address?

Class Person 
--------------
string Name{get;set;}
Contact Address{get;set;}
int id{get;set;}

Class Contact 
----------------

    string City;
    string State;
    string Country;

I need to bind to

Person.Contact.City

Upvotes: 1

Views: 326

Answers (1)

jfs
jfs

Reputation: 16798

Set the binding path to Address.City. This must be a property not a public field.

Upvotes: 3

Related Questions