Articles in this section
Category / Section

How to resize an MDI window to its child size in DocumentContainer?

MDIWindow size can be set to the size of child by setting SizeToContent property of DocumentContainer as True.

The same has been explained in the following code snippet:

XAML:

//Code Explains how to resize an MDI window to its child size in DocumentContainer
<Window
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" x:Class="DocumentContainer_Size_.MainWindow"
Title="MainWindow" Height="350" Width="525">
<Grid>
<syncfusion:DocumentContainer Name="Document" Mode="MDI"   >
 <ContentControl Name="size1" syncfusion:DocumentContainer.Header="Resize1" Height="200" Width="300"  syncfusion:DocumentContainer.SizetoContentInMDI="True">
<FlowDocument>
<Paragraph>
A DocumentContainer is a control that is used for holding the documents, controls 
and panels.
</Paragraph>
</FlowDocument>
</ContentControl>
<ContentControl syncfusion:DocumentContainer.Header="Control" Height="200" Width="300" syncfusion:DocumentContainer.SizetoContentInMDI="True">
<FlowDocument>
<Paragraph>
  Document Container Test
</Paragraph>
</FlowDocument>
</ContentControl>
</syncfusion:DocumentContainer>
</Grid>
</Window>

 

C#:

//Code Explains how to resize an MDI window to its child size in DocumentContainer
namespace DocumentContainer_Size
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
DocumentContainer.SetSizetoContentInMDI(size1,true);
}
}
}

Output:

Enable:

C:\Users\Ashok.Murugesan\Desktop\Switchmode\SizetoContentEnable.png

Disable:

C:\Users\Ashok.Murugesan\Desktop\Switchmode\SizetoContentDisable.png

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