However, this thread is old ... I did not find an easy solution to this problem, so I myself investigated it. This is the result:
Inherit a specialized Treeview that has the desired behavior from Treeview. Override MouseDown and double check if it will be. If so, prevent expansion / failure by setting a flag to suppress the action. BeforeExpand / collapse are redefined to cancel the action if the flag is set. You can reset the flag in your BeforeExpand / Collapse-EventHandler if you wish.
Public Class DblClickTreeview Inherits TreeView Private _SupressExpColl As Boolean = False Private _LastClick As DateTime = Now Protected Overrides Sub OnMouseDown(e As MouseEventArgs) _SupressExpColl = Now.Subtract(_LastClick).TotalMilliseconds <= SystemInformation.DoubleClickTime _LastClick = Now MyBase.OnMouseDown(e) End Sub Protected Overrides Sub OnBeforeCollapse(e As TreeViewCancelEventArgs) e.Cancel = _SupressExpColl MyBase.OnBeforeCollapse(e) End Sub Protected Overrides Sub OnBeforeExpand(e As TreeViewCancelEventArgs) e.Cancel = _SupressExpColl MyBase.OnBeforeExpand(e) End Sub End Class
source share