Articles in this section
Category / Section

How to restrict the automatic resize of docked window while maximizing MainWindow of WPF DockingManager?

1 min read

This article describes about DesiredWidth of the Docked Window is not updated properly while setting desiredwidth from codebehind while maximizing the MainWindow.

Set AllowProportionalResize property of WPF DockingManager as false to restrict the automatic resize of docked window while maximizing MainWindow.

The following code example demonstrates the same.

XAML

<Grid>
   <syncfusion:DockingManager DockFill="False" x:Name="DockManager" AllowProportionalResize="False" UseDocumentContainer="True">
     <ContentControl x:Name="Tab1" syncfusion:DockingManager.DesiredWidthInDockedMode="300"
syncfusion:DockingManager.Header="Tab1" syncfusion:DockingManager.State="Dock">
       <DockPanel Background="Red" >
         <Rectangle Width="300" Fill="LightGray"/>
       </DockPanel>
     </ContentControl>
     <ContentControl x:Name="Tab2" syncfusion:DockingManager.Header="Tab2" syncfusion:DockingManager.State="Document">
       <DockPanel >
         <Label Content="&lt;= Resize me" Height="28" Name="label1" />
         <Button Content="Restore Default Size" Height="23" Name="button1" Width="119" Click="button1_Click" />
       </DockPanel>
     </ContentControl>
     <ContentControl x:Name="Tab3" 
syncfusion:DockingManager.DesiredHeightInDockedMode ="200"
syncfusion:DockingManager.Header="Tab3" 
syncfusion:DockingManager.State="Dock"
syncfusion:DockingManager.SideInDockedMode="Bottom">
       <DockPanel Background="Red">
         <Rectangle Height="180" Fill="LightGray"/>
       </DockPanel>
     </ContentControl>
   </syncfusion:DockingManager>
</Grid>

C#

public partial class MainWindow : Window
{
  public MainWindow()
  {
    this.WindowState = System.Windows.WindowState.Maximized;
    InitializeComponent();
  }
 
  private void Window_StateChanged(object sender, System.EventArgs e)
  {
    if(WindowState == System.Windows.WindowState.Maximized)
      resizeDock();
  }
 
  private void button1_Click(object sender, RoutedEventArgs e)
  {
    resizeDock();
  }
 
  private void resizeDock()
  {
    DockingManager.SetDesiredWidthInDockedMode(Tab1, 300);
    DockingManager.SetDesiredHeightInDockedMode(Tab3, 200);
  }
}

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied