Category / Section
How to change the width of WPF DockingManager document tab header?
1 min read
WPF DockingManager does not have direct option to change the width of the document tab header, but the width can be changed by accessing the TabControlExt used inside the document child of the DockingManager. The following code example demonstrates how to change the width of the document tab header.
C#
(this.dockingmanger.DocContainer as DocumentContainer).Loaded += MainWindow_Loaded; private void MainWindow_Loaded(object sender, RoutedEventArgs e) { TabControlExt tabControlExt = VisualUtils.FindDescendant(sender as Visual, typeof(TabControlExt)) as TabControlExt; if (tabControlExt != null) { foreach (TabItemExt tabItemExt in tabControlExt.Items) { tabItemExt.Width = 130; } } }
VB
AddHandler TryCast(Me.dockingmanger.DocContainer, DocumentContainer).Loaded, AddressOf MainWindow_Loaded Private Sub MainWindow_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs) Dim tabControlExt As TabControlExt = TryCast(VisualUtils.FindDescendant(TryCast(sender, Visual), GetType(TabControlExt)), TabControlExt) If tabControlExt IsNot Nothing Then For Each tabItemExt As TabItemExt In tabControlExt.Items tabItemExt.Width = 130 Next tabItemExt End If End Sub