本文主要讲解通过C1DockControl和TabPages头部的鼠标双击事件来修改C1DockControl的停靠状态。
在窗体中添加C1DockTabControl控件之后,我们需要实现它的MouseDoubleClick事件,添加代码来控制C1Docktabcontrol的DockMode属性,从而达到停靠和浮动的显示效果,代码如下:
If TypeOf e.OriginalSource Is TextBlock Then
Dim dc As C1DockTabControl
If e.Source.[GetType]() = GetType(C1.WPF.Docking.C1DockTabItem) Then
dc = TryCast(TryCast(e.Source, C1DockTabItem).Parent, C1DockTabControl)
Else
dc = TryCast(e.Source, C1DockTabControl)
End If
If dc.DockMode = DockMode.Docked Then
dc.DockMode = DockMode.Floating
ElseIf dc.DockMode = DockMode.Floating Then
dc.DockMode = DockMode.Docked
End If
End If