本文整理汇总了C#中TreeList.ExpandAll方法的典型用法代码示例。如果您正苦于以下问题:C# TreeList.ExpandAll方法的具体用法?C# TreeList.ExpandAll怎么用?C# TreeList.ExpandAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeList
的用法示例。
在下文中一共展示了TreeList.ExpandAll方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadFromFile
public static void LoadFromFile(TreeList pTreeList, String pFullFileName)
{
if (!String.IsNullOrEmpty(pFullFileName))
{
DataSet dataSet = new DataSet();
dataSet.ReadXml(pFullFileName);
pTreeList.DataSource = dataSet.Tables[0].DefaultView;
pTreeList.ExpandAll();
}
}
示例2: TreeDataBind
private void TreeDataBind(List<BOM_Struct> list, TreeList treeList)
{
treeList.Nodes.Clear();
TreeListNode parentNode = null;
var parentList = list.FindAll(s => s.Parent_Id == 0);
foreach (var p in parentList)
{
var m = productStructService.GetMaterialById(p.Material_Id);
parentNode = treeList.AppendNode(new object[] { p.Material_Id, p.Id, p.BOM_Id, p.Parent_Id, m.No + "," + m.Version + "," + m.Name + "," + "1000" }, 0);
GetChildNode(parentNode, p.Id, list);
}
treeList.ExpandAll();
if (treeList.FocusedNode == null) return;
var _materialId = Convert.ToInt32(treeList.FocusedNode.GetValue("Material_Id"));
var material = productStructService.GetMaterialById(_materialId);
MaterialDataLoad(material);
DocumentDataLoad(material);
}
示例3: CreateTreeListColumnControl
/// <summary>
/// 创建TreeList控件
/// </summary>
/// <param name="treeList"></param>
private void CreateTreeListColumnControl(TreeList treeList)
{
treeList.Dock = DockStyle.Fill;
treeList.OptionsBehavior.Editable = false;
treeList.LookAndFeel.UseDefaultLookAndFeel = false;
treeList.LookAndFeel.UseWindowsXPTheme = true;
treeList.OptionsView.ShowColumns = false;
treeList.OptionsView.ShowIndicator = false;
var column1 = new DevExpress.XtraTreeList.Columns.TreeListColumn
{
FieldName = "Material_Id",
MinWidth = 38,
Name = "column1",
VisibleIndex = 2
};
column1.Visible = false;
var column2 = new DevExpress.XtraTreeList.Columns.TreeListColumn
{
FieldName = "Id",
MinWidth = 38,
Name = "column2",
VisibleIndex = 3
};
column2.Visible = false;
var column3 = new DevExpress.XtraTreeList.Columns.TreeListColumn
{
FieldName = "Parent_Id",
MinWidth = 38,
Name = "column3",
VisibleIndex = 4
};
column3.Visible = false;
var column4 = new DevExpress.XtraTreeList.Columns.TreeListColumn
{
FieldName = "BOM_Id",
MinWidth = 38,
Name = "column4",
VisibleIndex = 5
};
column4.Visible = false;
var column5 = new DevExpress.XtraTreeList.Columns.TreeListColumn
{
FieldName = "Material_Name",
MinWidth = 38,
Name = "MaterialName",
VisibleIndex = 1
};
column5.AppearanceCell.Options.UseTextOptions = true;
column5.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;
treeList.Columns.AddRange(new DevExpress.XtraTreeList.Columns.TreeListColumn[]
{
column1,column2,column4,column3,column5
});
treeList.ExpandAll();
}
示例4: TreeDataBind
private void TreeDataBind(List<BOM_Struct> list, TreeList treeList)
{
Stopwatch watch = new Stopwatch();
watch.Start();
//var dt = new DataTable();
//treeList.Nodes.Clear();
//treeList.DataSource = null;
////FillData(dt);
//treeList.DataSource = FillData(structList);
//treeList.KeyFieldName = "Id";
//treeList.ParentFieldName = "Parent_Id";
treeList.Nodes.Clear();
TreeListNode parentNode = null;
var parentList = list.FindAll(s => s.Parent_Id == 0);
foreach (var p in parentList)
{
var m = productStructService.GetMaterialById(p.Material_Id);
parentNode = treeList.AppendNode(new object[] { p.Material_Id, p.Id, p.BOM_Id, p.Parent_Id, m.No + "," + m.Version + "," + m.Name + "," + "1000" }, 0);
GetChildNode(parentNode, p.Id, list);
}
treeList.ExpandAll();
watch.Stop();
string time = watch.ElapsedMilliseconds.ToString();
//MessageBox.Show(time);
if (treeList.FocusedNode == null) return;
MaterialId = Convert.ToInt32(treeList.FocusedNode.GetValue("Material_Id"));
var material = Material(MaterialId);
MaterialDataLoad(material);
DocumentDataLoad(material);
}
示例5: ShowFilter
public static void ShowFilter(
TreeList treeList, bool readOnly, string idField,
string idParent, FilterConditionEnum filterCondition)
{
object prevalue = null;
TreeListColumn currentColumn = null;
bool Flag = false;
Dictionary<string, object> preValue = new Dictionary<string, object>();
Dictionary<string, int> indexCondition = new Dictionary<string, int>();
//Chèn row filter vào treelist
DataTable dtSource = (DataTable)treeList.DataSource;
DataRow filterRow = dtSource.NewRow();
foreach (DataColumn column in dtSource.Columns)
{
try
{
if (column.ColumnName != idField && column.ColumnName != idParent)
{
try
{
filterRow[column.ColumnName] = "";
}
catch
{
filterRow[column.ColumnName] = DBNull.Value;
}
}
}
catch (Exception ex) { PLException.AddException(ex); }
}
filterRow[idField] = long.MinValue;
filterRow[idParent] = long.MinValue;
dtSource.Rows.InsertAt(filterRow, 0);
treeList.OptionsBehavior.EnableFiltering = true;
treeList.OptionsBehavior.AutoSelectAllInEditor = false;
treeList.OptionsBehavior.Editable = false;
treeList.OptionsBehavior.EnterMovesNextColumn = true;
treeList.ExpandAll();
if (readOnly)
{
treeList.AfterFocusNode += delegate(object sender, NodeEventArgs e)
{
if (e.Node.Id == 0)
treeList.OptionsBehavior.Editable = true;
else
treeList.OptionsBehavior.Editable = false;
};
}
else
treeList.OptionsBehavior.Editable = true;
treeList.FocusedNodeChanged += delegate(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
{
try
{
if (e.Node.Id == 0)
treeList.OptionsBehavior.Editable = true;
else
treeList.OptionsBehavior.Editable = false;
}
catch { }
};
treeList.FocusedColumnChanged += delegate(object sender, DevExpress.XtraTreeList.FocusedColumnChangedEventArgs e)
{
if (Flag)
{
Flag = false;
treeList.FocusedColumn = currentColumn;
treeList.ShowEditor();
}
};
treeList.ValidateNode += delegate(object sender, ValidateNodeEventArgs e)
{
try
{
if (e.Node.Id == 0)
e.Valid = true;
}
catch { }
};
treeList.CellValueChanged += delegate(object sender, DevExpress.XtraTreeList.CellValueChangedEventArgs e)
{
try
{
if (e.Node.Id == 0)
{
Flag = true;
currentColumn = e.Column;
object value;
int index;
preValue.TryGetValue(e.Column.FieldName, out value);
indexCondition.TryGetValue(e.Column.FieldName, out index);
treeList.FilterConditions[index].Value1 = prevalue;
treeList.FilterConditions[index].Visible = true;
//.........这里部分代码省略.........