public static void SetData(ToolPrintData data) { if (treeViewState == null) { treeViewState = new TreeViewState(); } if (data == null) { return; } IList <int> expandIdList = null; if (treeView != null) { expandIdList = treeView.GetExpanded(); } treeView = new ToolPrintDataTree(treeViewState); id = 0; treeView.root.AddChild(GetTreeViewItem(data)); treeView.Reload(); if (expandIdList != null) { if (needExpand && useOldExpand) { for (int i = 0; i < expandIdList.Count; i++) { treeView.SetExpanded(expandIdList[i], true); } } else { for (int i = 0; i < expandIdList.Count; i++) { treeView.SetExpanded(expandIdList[i], false); } } } _canShow = true; }