C# DevExpress TreeListLookUpEdit 绑定数据源下拉窗体


C# Code:
/// <summary>
/// 绑定财务科目树
/// </summary>
/// <param name="lue">TreeListLookUpEdit组件</param>
/// <param name="imageList">图标</param>
public static void BoundAccountItem(TreeListLookUpEdit lue, ImageList imageList, DataTable treeData)
{
//创建TreeList的列
TreeListColumn col_Popup_CategoryName = new TreeListColumn();
col_Popup_CategoryName.Caption = "科目名称";
col_Popup_CategoryName.FieldName = tb_AccountItems.ItemName;
col_Popup_CategoryName.Name = "col_Popup_ItemName";
col_Popup_CategoryName.Visible = true;
col_Popup_CategoryName.VisibleIndex = 0;
col_Popup_CategoryName.Width = 130;
//TreeListLookUpEdit.Properties
lue.Properties.NullText = "";
lue.Properties.DisplayMember = tb_AccountItems.ItemName;
lue.Properties.ValueMember = tb_AccountItems.ItemID;
TreeList tree = lue.Properties.TreeList;
tree.StateImageList = imageList;
tree.Columns.Clear();
tree.Columns.AddRange(new DevExpress.XtraTreeList.Columns.TreeListColumn[] { col_Popup_CategoryName });
tree.OptionsView.ShowSummaryFooter = false;
tree.KeyFieldName = tb_AccountItems.ItemID;//设置主键
tree.ParentFieldName = tb_AccountItems.ParentID;//设置父级主键
tree.RootValue = "";//顶级树结点的值
tree.DataSource = treeData.Copy();
DevStyle.SetTreeListSelectStyle(tree);
DevTreeListView.SetImageIndex(tree, null, 1, 0);
tree.ExpandAll();
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761
/// 绑定财务科目树
/// </summary>
/// <param name="lue">TreeListLookUpEdit组件</param>
/// <param name="imageList">图标</param>
public static void BoundAccountItem(TreeListLookUpEdit lue, ImageList imageList, DataTable treeData)
{
//创建TreeList的列
TreeListColumn col_Popup_CategoryName = new TreeListColumn();
col_Popup_CategoryName.Caption = "科目名称";
col_Popup_CategoryName.FieldName = tb_AccountItems.ItemName;
col_Popup_CategoryName.Name = "col_Popup_ItemName";
col_Popup_CategoryName.Visible = true;
col_Popup_CategoryName.VisibleIndex = 0;
col_Popup_CategoryName.Width = 130;
//TreeListLookUpEdit.Properties
lue.Properties.NullText = "";
lue.Properties.DisplayMember = tb_AccountItems.ItemName;
lue.Properties.ValueMember = tb_AccountItems.ItemID;
TreeList tree = lue.Properties.TreeList;
tree.StateImageList = imageList;
tree.Columns.Clear();
tree.Columns.AddRange(new DevExpress.XtraTreeList.Columns.TreeListColumn[] { col_Popup_CategoryName });
tree.OptionsView.ShowSummaryFooter = false;
tree.KeyFieldName = tb_AccountItems.ItemID;//设置主键
tree.ParentFieldName = tb_AccountItems.ParentID;//设置父级主键
tree.RootValue = "";//顶级树结点的值
tree.DataSource = treeData.Copy();
DevStyle.SetTreeListSelectStyle(tree);
DevTreeListView.SetImageIndex(tree, null, 1, 0);
tree.ExpandAll();
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761

扫一扫加微信


版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网