添加一个数据模型
AccordionControl可以被束缚到任何实现IEnumerable接口的对象或者它的派生类(例如IList,ICollection)
如下代码例子示范了一个简单的数据模型使用:
using System.Collections.Generic;
namespace DxAccordionGettingStarted {
public class Employee {
public int ID { get; set; }
public string Name { get; set; }
public string Position { get; set; }
public string Department { get; set; }
public override string ToString() {
return Name;
}
}
public static class Staff {
public static List<Employee> GetStaff() {
List<Employee> employees = new List<Employee>();
employees.Add(new Employee() { ID = 1, Name = "Gregory S. Price", Department = "Management", Position = "President" });
employees.Add(new Employee() { ID = 2, Name = "Irma R. Marshall", Department = "Marketing", Position = "Vice President" });
employees.Add(new Employee() { ID = 3, Name = "John C. Powell", Department = "Operations", Position = "Vice President" });
employees.Add(new Employee() { ID = 4, Name = "Christian P. Laclair", Department = "Production", Position = "Vice Preside