当前位置: 首页 > news >正文

广东网站建设服务供应商优化水平

广东网站建设服务供应商,优化水平,建设能源官方网站,免费官方网站创建此教程示范如何添加TreeListControl到项目和绑定控件自引用数据源: 添加数据模型 绑定tree,并添加如下字段到数据源对象: Key字段包含唯一值索引节点 Parent字段包含父索引节点 添加数据模型(Employee和Staff类)到…

此教程示范如何添加TreeListControl到项目和绑定控件自引用数据源:

添加数据模型

绑定tree,并添加如下字段到数据源对象:

Key字段包含唯一值索引节点

Parent字段包含父索引节点

添加数据模型(Employee和Staff类)到MainWindow.xaml.cs 文件:

namespace DxTreeListGettingStarted {public partial class MainWindow : Window { ... }public class Employee {public int ID { get; set; }public int ParentID { get; set; }public string Name { get; set; }public string Position { get; set; }public string Department { get; set; }}public static class Staff {public static List<Employee> GetStaff() {List<Employee> staff = new List<Employee>();staff.Add(new Employee() { ID = 0, Name = "Gregory S. Price", Department = "", Position = "President" });staff.Add(new Employee() { ID = 1, ParentID = 0, Name = "Irma R. Marshall", Department = "Marketing", Position = "Vice President" });staff.Add(new Employee() { ID = 2, ParentID = 0, Name = "John C. Powell", Department = "Operations", Position = "Vice President" });staff.Add(new Employee() { ID = 3, ParentID = 0, Name = "Christian P. Laclair", Department = "Production", Position = "Vice President" });staff.Add(new Employee() { ID = 4, ParentID = 0, Name = "Karen J. Kelly", Department = "Finance", Position = "Vice President" });staff.Add(new Employee() { ID = 5, ParentID = 1, Name = "Brian C. Cowling", Department = "Marketing", Position = "Manager" });staff.Add(new Employee() { ID = 6, ParentID = 1, Name = "Thomas C. Dawson", Department = "Marketing", Position = "Manager" });staff.Add(new Employee() { ID = 7, ParentID = 1, Name = "Angel M. Wilson", Department = "Marketing", Position = "Manager" });staff.Add(new Employee() { ID = 8, ParentID = 1, Name = "Bryan R. Henderson", Department = "Marketing", Position = "Manager" });staff.Add(new Employee() { ID = 9, ParentID = 2, Name = "Harold S. Brandes", Department = "Operations", Position = "Manager" });staff.Add(new Employee() { ID = 10, ParentID = 2, Name = "Michael S. Blevins", Department = "Operations", Position = "Manager" });staff.Add(new Employee() { ID = 11, ParentID = 2, Name = "Jan K. Sisk", Department = "Operations", Position = "Manager" });staff.Add(new Employee() { ID = 12, ParentID = 2, Name = "Sidney L. Holder", Department = "Operations", Position = "Manager" });staff.Add(new Employee() { ID = 13, ParentID = 3, Name = "James L. Kelsey", Department = "Production", Position = "Manager" });staff.Add(new Employee() { ID = 14, ParentID = 3, Name = "Howard M. Carpenter", Department = "Production", Position = "Manager" });staff.Add(new Employee() { ID = 15, ParentID = 3, Name = "Jennifer T. Tapia", Department = "Production", Position = "Manager" });staff.Add(new Employee() { ID = 16, ParentID = 4, Name = "Judith P. Underhill", Department = "Finance", Position = "Manager" });staff.Add(new Employee() { ID = 17, ParentID = 4, Name = "Russell E. Belton", Department = "Finance", Position = "Manager" });return staff;}}
}

添加视图模型

创建视图模型暴露Employees字段:

using DevExpress.Mvvm;namespace DxTreeListGettingStarted {public partial class MainWindow : Window { ... }public class Employee { ... }public static class Staff { ... }public class MainWindowViewModel : ViewModelBase {public MainWindowViewModel() {Employees = Staff.GetStaff();}public List<Employee> Employees { get; private set; }}
}

设置window数据上下文到视图模型:

<Window... ><Window.DataContext><local:MainWindowViewModel/></Window.DataContext>

添加TreeListControl到视图

拖动TreeListControl组件从工具箱到form里面

选择TreeListControl点击Quick Actions

点击重新计算按钮到ItemsSource属性调用上下文菜单。选择创建数据绑定

选择Employees在对话框点击OK

设置AutoGenerateColumns添加AddNew

切换到XAML视图,定义TreeListControl 视图:

<dxg:TreeListControl AutoGenerateColumns="AddNew" ItemsSource="{Binding Employees}"><dxg:TreeListControl.View><dxg:TreeListView /></dxg:TreeListControl.View>
</dxg:TreeListControl>

返回设计器视图,选择TreeListView调用Quick Actions

启动AutoWidth和AutoExpandAllNodes选项。指定服务行(TreeListView.KeyFieldName 和 TreeListView.ParentFieldName)生成tree:

<dxg:TreeListControl ItemsSource="{Binding Employees}"AutoGenerateColumns="AddNew" ><dxg:TreeListControl.View><dxg:TreeListView KeyFieldName="ID" ParentFieldName="ParentID"AutoWidth="True" AutoExpandAllNodes="True" /></dxg:TreeListControl.View>
</dxg:TreeListControl>

运行程序

http://www.dinnco.com/news/85617.html

相关文章:

  • 长安网站建设制作价格如何推广自己的微信号
  • python免费自学网站百度识图网页版在线
  • 慈善网站建设方案企业网站的推广形式有
  • 网站建设与运营 教材 崔网站关键词快速排名软件
  • wordpress实现动态功能百度关键词优化方法
  • 0716网站建设seo实战
  • 宝石网站建设谷歌搜索引擎镜像
  • 全球优秀网页设计机构网站优化推广招聘
  • wordpress 云解析视频教程seo主管招聘
  • 电商思维做招聘网站北京seo关键词排名
  • 深圳小程序开发外包seo推广人员
  • 郴州市优化网站seo策略
  • 2018什么语言做网站比较好网络营销最主要的工具是
  • 最全做暖暖网站网络推广方案范例
  • 有创意的个人网站名字宁波seo快速优化平台
  • 建网站的平台网站收录检测
  • 网站规划与建设是什么西安网站seo推广
  • 做网站推销好做吗seo01
  • 建一个网站得多少钱郑州网络推广方法
  • 公众号怎么开通直播功能青岛百度推广seo价格
  • 求一些做里番的网站搜索引擎优化seo课程总结
  • 简单网站建设发帖百度秒收录网站分享
  • 重庆的做网站公司优化软件有哪些
  • 编程和做网站有关系吗中国免费广告网
  • p2p网站的建设百度搜索引擎优化的养成良好心态
  • 网站开发准备工作百度数据平台
  • 怎么设计一个网站网站优化+山东
  • 网页类网站宁波网站建设推广平台
  • 做策划的都上哪些网站搜索资料间cps广告联盟网站
  • 微网站建设招聘竞价托管就选微竞价