Index: Core/Common/src/Core.Common.Controls.TreeView/TreeViewControl.cs =================================================================== diff -u -r8cd0ee44574c687488d6dd531d0f2e5150913b54 -r53d0806e953dfe5bb0bce91299ae901b45c5afe2 --- Core/Common/src/Core.Common.Controls.TreeView/TreeViewControl.cs (.../TreeViewControl.cs) (revision 8cd0ee44574c687488d6dd531d0f2e5150913b54) +++ Core/Common/src/Core.Common.Controls.TreeView/TreeViewControl.cs (.../TreeViewControl.cs) (revision 53d0806e953dfe5bb0bce91299ae901b45c5afe2) @@ -80,13 +80,15 @@ private const string stateImageLocationString = "StateImage"; private const int uncheckedCheckBoxStateImageIndex = 0; private const int checkedCheckBoxStateImageIndex = 1; + private const int updateTimerInterval = 10; + private object data; + private Timer updateTimer; + private readonly DragDropHandler dragDropHandler = new DragDropHandler(); private readonly Dictionary tagTypeTreeNodeInfoLookup = new Dictionary(); private readonly Dictionary treeNodeObserverLookup = new Dictionary(); - private object data; - public event EventHandler DataDoubleClick; public event EventHandler SelectedDataChanged; public event EventHandler> DataDeleted; // TODO; Way to explicit! @@ -123,6 +125,8 @@ treeView.ItemDrag += TreeViewItemDrag; treeView.DragLeave += TreeViewDragLeave; treeView.AfterSelect += TreeViewAfterSelect; + + InitializeUpdateTimer(); } /// @@ -531,6 +535,8 @@ throw new InvalidOperationException("No tree node info registered"); } + StartUpdateTimer(); + // First of all refresh the child nodes as the other logic below might depend on the presence of child nodes RefreshChildNodes(treeNode, treeNodeInfo); @@ -936,5 +942,39 @@ } #endregion + + #region Update timer + + private void InitializeUpdateTimer() + { + updateTimer = new Timer + { + Interval = updateTimerInterval + }; + + updateTimer.Tick += UpdateTimerOnTick; + } + + private void StartUpdateTimer() + { + if (updateTimer.Enabled) + { + updateTimer.Stop(); + } + else + { + treeView.BeginUpdate(); + } + + updateTimer.Start(); + } + + private void UpdateTimerOnTick(object sender, EventArgs eventArgs) + { + treeView.EndUpdate(); + updateTimer.Stop(); + } + + #endregion } } \ No newline at end of file