使用wpf中的复合属性进行绑定

时间:2011-06-28 11:17:05

标签: wpf binding

我有一个名为Person的类,它包含另一个保存人员地址的对象'Contact'。我将person类绑定到wpf网格。我如何绑定地址内的属性?

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

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

    string City;
    string State;
    string Country;

我需要绑定到

  

Person.Contact.City

1 个答案:

答案 0 :(得分:3)

将绑定路径设置为Address.City。这必须是属性而不是公共领域。