private void gdb_DataSourceChanged(object sender, EventArgs e) { DataTable dt = (DataTable)gdb.DataSource; if (dt == null) { return; } //规避键值重复导致Tree报错 if (dt.DistinctTable("DictionaryItem_Value").Rows.Count == dt.Rows.Count) { trb.DataSource = gdb.DataSource; trb.Columns.Clear(); SharedFunc.CopyColumn(gvb, trb); trb.OptionsDragAndDrop.DragNodesMode = DevExpress.XtraTreeList.DragNodesMode.Single; trb.OptionsBehavior.Editable = false; } }