当前位置:   article > 正文

mvvm绑定checkbox wpf_WPF的MVVM模式给ComboBox绑定数据和读取

wpf mvvm checkbox

在网上找到类似的代码:

XAML文件

对应的ViewModel文件

public classLocationRoad

{public int ID { set; get; }public string Code { set; get; }public string Info { set; get; }

}/当ComboBox选中项更改时发生///privateLocationRoad _selectLocation;publicLocationRoad SelectLocation

{get{return this._selectLocation;

}set{this._selectLocation =value;if (this.PropertyChanged != null)

PropertyChanged(this, new PropertyChangedEventArgs("SelectLocation"));

}

}private ObservableCollection _locationRoad = null;publicObservableCollection LocationSource

{get{if (this._locationRoad == null)

{this._locationRoad = newObservableCollection() {new LocationRoad() { ID = 1, Code = "NGQ", Info = "南岗区"},new LocationRoad() { ID = 2, Code = "DLQ", Info = "道里区"},new LocationRoad() { ID = 3, Code = "DW

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
  

闽ICP备14008679号