开发者

WP7: how to databind to an object member?

开发者 https://www.devze.com 2023-04-13 07:27 出处:网络
I have a WP7 app that gets data from a DataContext. Say that I have a class Country { String country_name;

I have a WP7 app that gets data from a DataContext. Say that I have a

class Country {

    String country_name;
    int population;
    int density;

    ...

}

class City {

    String name;
    Country country;

}

I need to have, in databinding, the members of the Country class starting from City class.

If I make {Binding name}, I get the city name. How can I get Country properties? If I try {Binding country.country_name}, it does not work. Ho开发者_如何学编程w can I solve it?


Are you sure that doesn't work? It should. Are your classes implementing the INotifyPropertyChanged interface? If not, maybe the value is not set at the moment of the binding and without the notification the binding is never refreshed.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号