Example #1
0
        private void barBtnAddChild_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                TreeListNode currentNode = this.tlCategory.FocusedNode;
                if (currentNode == null)
                {
                    return;
                }
                var peer = new DecisionReasonCategoryEntity
                {
                    Name     = "新建分类",
                    ParentId = Convert.ToInt32(currentNode.GetValue(tcId)),
                    Remarks  = null,
                };
                peer.Id = _IDService.AddIDReasonCategory(peer);

                var source = this.tlCategory.DataSource as List <DecisionReasonCategoryEntity>;
                source.Add(peer);
                this.tlCategory.RefreshDataSource();
                this.tlCategory.SetFocusedNode(this.tlCategory.FocusedNode.LastNode);
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
        }
Example #2
0
        private void BindCategory()
        {
            var categories = _IDService.GetIDReasonCategories();

            var root = new DecisionReasonCategoryEntity()
            {
                Id       = 0,
                Name     = "全部",
                FullName = string.Empty,
                ParentId = -1,
                Remarks  = null,
            };

            categories.Add(root);

            this.tlCategory.Initialize(categories, "Id", "ParentId", editable: true, autoWidth: true, showColumns: false, showVertLines: false, showHorzLines: false);
            this.tlCategory.AllowDrop = false;
            this.tlCategory.OptionsDragAndDrop.DragNodesMode = DevExpress.XtraTreeList.DragNodesMode.Single;

            categories = null;
        }