private void PopulateTreeView(NG_ImageGroup Group, DevExpress.XtraTreeList.Nodes.TreeListNode Parent) { var _GroupNode = ImagesTreeList.AppendNode(new object[] { Group.GroupName, Group.UID.ToString(), "", "1" }, Parent); _GroupNode.ImageIndex = 0; _GroupNode.SelectImageIndex = 1; foreach (var i in Group.Images) { var _ImageNode = ImagesTreeList.AppendNode(new object[] { i.Name + " (" + i.ImageName + ")", i.UID.ToString(), "", "0" }, _GroupNode.Id); _ImageNode.ImageIndex = 2; _ImageNode.SelectImageIndex = 3; } foreach (var sg in Group.Groups) { PopulateTreeView(sg, _GroupNode); } }
private void InitTreeView() { ImagesTreeList.BeginUpdate(); ImagesTreeList.Columns.Add(); ImagesTreeList.Columns[0].Caption = "Name"; ImagesTreeList.Columns[0].VisibleIndex = 0; ImagesTreeList.Columns.Add(); ImagesTreeList.Columns[1].Caption = "ID"; ImagesTreeList.Columns[1].VisibleIndex = 1; ImagesTreeList.Columns.Add(); ImagesTreeList.Columns[2].Caption = "Tags"; ImagesTreeList.Columns[2].VisibleIndex = 2; ImagesTreeList.Columns.Add(); ImagesTreeList.Columns[3].Caption = "IsFolder"; ImagesTreeList.Columns[3].VisibleIndex = 3; ImagesTreeList.Columns[1].Visible = false; ImagesTreeList.Columns[2].Visible = false; ImagesTreeList.Columns[3].Visible = false; ImagesTreeList.EndUpdate(); }
private void ImagesTreeList_DragDrop(object sender, DragEventArgs e) { DevExpress.XtraTreeList.Nodes.TreeListNode DestinationNode; Point pt = ((DevExpress.XtraTreeList.TreeList)sender).PointToClient(new Point(e.X, e.Y)); //DevExpress.XtraTreeList.Nodes.TreeListNode DestinationNode = ((DevExpress.XtraTreeList.Nodes.TreeListNode)sender).Calc var _Info = ImagesTreeList.CalcHitInfo(pt); gto: DestinationNode = _Info.Node; if (DestinationNode == null) { goto gto; } DevExpress.XtraTreeList.Nodes.TreeListNode _Node = (DevExpress.XtraTreeList.Nodes.TreeListNode)e.Data.GetData("DevExpress.XtraTreeList.Nodes.TreeListNode"); StartGetNodeID: var _DestinationID = DestinationNode.GetValue("ID").ToString(); var _NodeID = _Node.GetValue("ID").ToString(); if (DestinationNode.GetValue("IsFolder").ToString().ToLower() == "1") { var _Group = _GroupCollection.GetGroupByID(_DestinationID); if (_Node.GetValue("IsFolder").ToString().ToLower() == "1") { _GroupCollection.MoveGroupToGroup(_Node.GetValue("ID").ToString(), _DestinationID); } } else { DestinationNode = DestinationNode.ParentNode; goto StartGetNodeID; } e.Effect = DragDropEffects.None; PopulateTreeView(); }
private void PopulateTreeView() { ImagesTreeList.Nodes.Clear(); ImagesTreeList.BeginUnboundLoad(); var _RootNode = ImagesTreeList.Nodes.Add(new object[] { "Project Images", "Root", "", "1" }); _RootNode.SelectImageIndex = 3; foreach (var t in _GroupCollection.Groups) { PopulateTreeView(t, _RootNode); } ImagesTreeList.EndUnboundLoad(); if (RecentlySelectedNode != "") { ImagesTreeList.FocusedNode = ImagesTreeList.FindNodeByFieldValue("ID", RecentlySelectedNode); } //Reset Node Focus }