mvvm observablecollection and binding (不翻译)
mvvm observablecollection and binding (不翻译)
我有一个模型:
public class Table : ViewModelBase { private int _id; private string _north; private string _east; private string _south; private string _west; public int Id { get { return _id; } set { _id = value; OnPropertyChanged(); } } public string North { get { return _north; } set { _north = value; OnPropertyChanged(); } } public string East { get { return _east; } set { _east = value; OnPropertyChanged(); } } public string South { get { return _south; } set { _south = value; OnPropertyChanged(); } } public string West { get { return _west; } set { _west = value; OnPropertyChanged(); } } }
还有一个声明了Tables列表的ViewModel:
Tables = new ObservableCollection