You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
123 lines
2.8 KiB
123 lines
2.8 KiB
using System; |
|
using System.Collections.Generic; |
|
using System.ComponentModel; |
|
using System.Linq; |
|
using System.Text; |
|
using System.Threading.Tasks; |
|
using System.Windows; |
|
|
|
namespace Kingo.Plugin.NYYP.Common |
|
{ |
|
public class KeyValueData |
|
{ |
|
public string NodeID { get; set; } |
|
public string NodeName { get; set; } |
|
} |
|
public class TreeData : INotifyPropertyChanged |
|
{ |
|
|
|
#region 字段 |
|
|
|
private string id; |
|
private string name; |
|
private Visibility visibility = Visibility.Collapsed; |
|
private List<TreeData> items; |
|
|
|
#endregion |
|
|
|
#region 属性 |
|
/// <summary> |
|
/// 获取或设置数据显示的ID |
|
/// </summary> |
|
public string ID |
|
{ |
|
get { return id; } |
|
set { id = value; this.OnPropertyChanged("ID"); } |
|
} |
|
|
|
public string Name |
|
{ |
|
get { return name; } |
|
set { name = value; } |
|
} |
|
|
|
/// <summary> |
|
/// 获取或设置数据子集 |
|
/// </summary> |
|
public List<TreeData> Items |
|
{ |
|
get { return items; } |
|
set |
|
{ |
|
items = value; |
|
this.OnPropertyChanged("Items"); |
|
} |
|
} |
|
|
|
/// <summary> |
|
/// Item上的自定义checkbox数据绑定 |
|
/// </summary> |
|
public Visibility Visibility |
|
{ |
|
get { return visibility; } |
|
set { visibility = value; this.OnPropertyChanged("Visibility"); } |
|
} |
|
#endregion |
|
|
|
public TreeData() |
|
{ |
|
|
|
} |
|
|
|
public TreeData(string name, string id, List<TreeData> items) |
|
{ |
|
this.Name = name; |
|
this.Items = items; |
|
this.ID = id; |
|
} |
|
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged; |
|
|
|
private void OnPropertyChanged(string prop) |
|
{ |
|
if (this.PropertyChanged != null) |
|
this.PropertyChanged(this, new PropertyChangedEventArgs(prop)); |
|
} |
|
|
|
} |
|
|
|
public class TreeModel : INotifyPropertyChanged |
|
{ |
|
private string name = string.Empty; |
|
|
|
|
|
public List<TreeData> Items { get; set; } |
|
|
|
/// <summary> |
|
/// 当前选中项的名称,用于comboBox显示 |
|
/// </summary> |
|
public string Name |
|
{ |
|
get { return name; } |
|
set |
|
{ |
|
name = value; |
|
this.OnPropertyChanged("Name"); |
|
} |
|
} |
|
|
|
public TreeModel() |
|
{ |
|
|
|
} |
|
|
|
public event PropertyChangedEventHandler PropertyChanged; |
|
private void OnPropertyChanged(string prop) |
|
{ |
|
if (this.PropertyChanged != null) |
|
this.PropertyChanged(this, new PropertyChangedEventArgs(prop)); |
|
} |
|
|
|
} |
|
}
|
|
|