Category / Section
How to restrict resizing of the docking child width in WPF DockingManager?
1 min read
To restrict the resizing of docking child width in the DockingManager, an attached property of WPF DockingManager CanResizeWidthInDockedState, need to set to False. By default, it value is True.
XAML
<Window x:Class="DockingManager_147867.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:syncfusion="http://schemas.syncfusion.com/wpf" Title="MainWindow" Height="350" Width="525"> <Grid x:Name="Grid1"> <syncfusion:DockingManager x:Name="DockingManager1" UseDocumentContainer="True" > <ContentControl x:Name="Content1" syncfusion:DockingManager.State="Dock" syncfusion:DockingManager.Header="Child1" syncfusion:DockingManager.CanResizeWidthInDockedState="False"/> <ContentControl x:Name="Content2" syncfusion:DockingManager.State="Document" syncfusion:DockingManager.Header="Child2"/> <ContentControl x:Name="Content3" syncfusion:DockingManager.State="Dock" syncfusion:DockingManager.Header="Child3"/> </syncfusion:DockingManager> </Grid> </Window>
C#
using Syncfusion.Windows.Tools.Controls; namespace DockingManager_147867 { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); DockingManager dock = new DockingManager(); dock.UseDocumentContainer = true; ContentControl content1 = new ContentControl(); DockingManager.SetHeader(content1, "Child1"); DockingManager.SetState(content1, DockState.Dock); DockingManager.SetCanResizeWidthInDockedState(content1, false); ContentControl content2 = new ContentControl(); DockingManager.SetHeader(content2, "Child2"); DockingManager.SetState(content2, DockState.Document); ContentControl content3 = new ContentControl(); DockingManager.SetHeader(content3, "Child3"); DockingManager.SetState(content3, DockState.Dock); dock.Children.Add(content1); dock.Children.Add(content2); dock.Children.Add(content3); Grid1.Children.Add(dock); } } }