Hello,
We set ContainerMinSize only when the window is floating.
I could reproduce the issue on sample project if I removed ContainerMinSize from document window and added the following style to document window.
Would you please check it?
<docking:DocumentWindow.Style>
<Style TargetType="docking:DocumentWindow">
<Style.Triggers>
<Trigger Property="IsFloating" Value="True">
<Setter Property="ContainerMinSize">
<Setter.Value>
<Size>
400
400
</Size>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</docking:DocumentWindow.Style>
Whole source code of MainControl.xaml:
<sampleBrowser:ProductItemControl
x:Class="ActiproSoftware.ProductSamples.DockingSamples.QuickStart.LayoutSerialization.MainControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:docking="http://schemas.actiprosoftware.com/winfx/xaml/docking"
xmlns:sampleBrowser="clr-namespace:ActiproSoftware.SampleBrowser"
xmlns:shared="http://schemas.actiprosoftware.com/winfx/xaml/shared">
<sampleBrowser:ProductItemControl.Resources>
<!-- Converters -->
<shared:ImageConverter x:Key="ImageConverter" />
</sampleBrowser:ProductItemControl.Resources>
<sampleBrowser:ProductItemControl.SideBarContent>
<StackPanel>
<Expander Style="{StaticResource SampleHeaderDescriptionExpanderStyle}">
<TextBlock Style="{StaticResource SampleHeaderDescriptionTextBlockStyle}">
This QuickStart shows how you can persist the layout of docking windows.
Layout data is typically saved when an application is closed and then restored when the application is reopened.
Layout data can also be used to restore a default layout.<LineBreak /><LineBreak />
In this particular sample, the layout data is maintained in a static member variable.
Change the layout by dragging tool windows to other locations.
Then switch to another sample and switch back to this sample.
You should see the same tool window layout as when you last left the sample.<LineBreak /><LineBreak />
By default, only the layout of the tool windows is retained, but this can be changed via a serializer option.
By unchecking the Only Save ToolWindow Layout menu item, the entire layout, including documents and the MDI, can be saved and restored.
Each docking window also has a CanSerialize property that can be set to false to prevent it from being included in the layout data.<LineBreak /><LineBreak />
There are also three Layout menu items that determine how unknown windows in a layout are handled.
This situation occurs in this sample when a programmatic tool window is added, then the sample is switched, and reopened.
In that scenario, the programmatic tool window isn't known to the DockSite, but it has layout data in the XML.
The layout data can be discarded (default), auto-created, or lazy loaded.<LineBreak /><LineBreak />
Since the layout data of this sample is saved in a static member variable,
changes are not maintained if the entire Sample Browser application is closed.
That behavior can easily be updated to save the layout to a file instead.</TextBlock>
</Expander>
</StackPanel>
</sampleBrowser:ProductItemControl.SideBarContent>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- DockSite -->
<docking:DockSite
x:Name="dockSite"
Grid.Row="1"
CanDocumentWindowsFloat="True"
CanToolWindowsFloat="True">
<docking:DockSite.AutoHideLeftContainers>
<docking:ToolWindowContainer>
<docking:ToolWindow
x:Name="toolboxToolWindow"
Title="Toolbox"
ImageSource="/Images/Icons/Toolbox16.png">
<TextBlock
Margin="5"
Text="Place toolbox items here."
TextWrapping="Wrap" />
</docking:ToolWindow>
</docking:ToolWindowContainer>
</docking:DockSite.AutoHideLeftContainers>
<docking:SplitContainer>
<!-- Workspace -->
<docking:Workspace>
<docking:TabbedMdiHost x:Name="tabbedMdiHost">
<docking:TabbedMdiContainer>
<docking:DocumentWindow
Title="Saved Layout XML"
CanClose="False"
ImageSource="/Images/Icons/TextDocument16.png"
SerializationId="LayoutDataDocument">
<docking:DocumentWindow.Style>
<Style TargetType="docking:DocumentWindow">
<Style.Triggers>
<Trigger Property="IsFloating" Value="True">
<Setter Property="ContainerMinSize">
<Setter.Value>
<Size>
400
400
</Size>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</docking:DocumentWindow.Style>
<TextBox
x:Name="layoutXmlTextBox"
AcceptsReturn="True"
BorderThickness="0"
HorizontalScrollBarVisibility="Auto"
IsReadOnly="True"
VerticalScrollBarVisibility="Auto" />
</docking:DocumentWindow>
</docking:TabbedMdiContainer>
</docking:TabbedMdiHost>
</docking:Workspace>
<docking:ToolWindowContainer>
<docking:ToolWindow
x:Name="solutionExplorerToolWindow"
Title="Solution Explorer"
ContainerMinSize="200,400"
ImageSource="/Images/Icons/SolutionExplorer16.png">
<TreeView BorderThickness="0">
<TreeViewItem Header="Solution 'Actipro Controls' (1 project)" IsExpanded="True">
<TreeViewItem Header="ControlsSample" IsExpanded="True">
<TreeViewItem Header="Properties" />
<TreeViewItem Header="References" />
<TreeViewItem Header="Demo.cs" />
</TreeViewItem>
</TreeViewItem>
</TreeView>
</docking:ToolWindow>
<docking:ToolWindow
x:Name="classViewToolWindow"
Title="Class View"
ImageSource="/Images/Icons/ClassView16.png">
<TreeView BorderThickness="0">
<TreeViewItem Header="ControlsSample" IsExpanded="True">
<TreeViewItem Header="Project References" />
<TreeViewItem Header="ActiproSoftware.ProductSamples.DockingSamples" />
<TreeViewItem Header="ActiproSoftware.ProductSamples.EditorsSamples" />
<TreeViewItem Header="ActiproSoftware.ProductSamples.SharedSamples" />
<TreeViewItem Header="ActiproSoftware.SampleBrowser" />
<TreeViewItem Header="XamlGeneratedNamespace" />
</TreeViewItem>
</TreeView>
</docking:ToolWindow>
<docking:ToolWindow
x:Name="documentOutlineToolWindow"
Title="Document Outline"
ImageSource="/Images/Icons/DocumentOutline16.png">
<TextBox
BorderThickness="0"
IsReadOnly="True"
Text="(not available)"
TextWrapping="Wrap" />
</docking:ToolWindow>
</docking:ToolWindowContainer>
</docking:SplitContainer>
</docking:DockSite>
<!-- Menu -->
<shared:PixelSnapper>
<Menu>
<MenuItem Header="_Layout">
<MenuItem
x:Name="saveToolWindowLayoutOnlyMenuItem"
Click="OnSaveLayoutMenuItemClick"
Header="Only Save ToolWindow Layout"
IsCheckable="True"
IsChecked="True" />
<MenuItem
Click="OnSaveLayoutMenuItemClick"
Header="Can Serialize Class View"
IsCheckable="True"
IsChecked="{Binding ElementName=classViewToolWindow, Path=CanSerialize, Mode=TwoWay}" />
<Separator />
<MenuItem
x:Name="discardMenuItem"
Click="OnWindowDeserializationOptionMenuItemClick"
Header="Discard Unknown Windows"
IsChecked="True" />
<MenuItem
x:Name="autoCreateMenuItem"
Click="OnWindowDeserializationOptionMenuItemClick"
Header="Auto-Create Unknown Windows" />
<MenuItem
x:Name="lazyLoadMenuItem"
Click="OnWindowDeserializationOptionMenuItemClick"
Header="Lazy Load Unknown Windows" />
<Separator />
<MenuItem Click="OnLoadDefaultLayoutMenuItemClick" Header="Reload Default Layout" />
<Separator />
<MenuItem Click="OnLoadLayoutMenuItemClick" Header="Load Layout" />
<MenuItem Click="OnSaveLayoutMenuItemClick" Header="Save Layout" />
</MenuItem>
<MenuItem Header="_Activate">
<MenuItem
x:Name="activeProgrammaticToolWindow1"
Click="OnActivateProgrammaticToolWindow1Click"
Header="Create Programmatic ToolWindow 1"
Icon="{Binding Source='pack://application:,,,/SampleBrowser;component/Images/Icons/Properties16.png', Converter={StaticResource ImageConverter}}" />
<MenuItem
x:Name="activeProgrammaticToolWindow2"
Click="OnActivateProgrammaticToolWindow2Click"
Header="Create Programmatic ToolWindow 2"
Icon="{Binding Source='pack://application:,,,/SampleBrowser;component/Images/Icons/Properties16.png', Converter={StaticResource ImageConverter}}" />
<Separator />
<MenuItem
Command="{Binding ElementName=classViewToolWindow, Path=ActivateCommand}"
Header="Activate Class View"
Icon="{Binding Source='pack://application:,,,/SampleBrowser;component/Images/Icons/ClassView16.png', Converter={StaticResource ImageConverter}}" />
<MenuItem
Command="{Binding ElementName=documentOutlineToolWindow, Path=ActivateCommand}"
Header="Activate Document Outline"
Icon="{Binding Source='pack://application:,,,/SampleBrowser;component/Images/Icons/DocumentOutline16.png', Converter={StaticResource ImageConverter}}" />
<MenuItem
Command="{Binding ElementName=solutionExplorerToolWindow, Path=ActivateCommand}"
Header="Activate Solution Explorer"
Icon="{Binding Source='pack://application:,,,/SampleBrowser;component/Images/Icons/SolutionExplorer16.png', Converter={StaticResource ImageConverter}}" />
<MenuItem
Command="{Binding ElementName=toolboxToolWindow, Path=ActivateCommand}"
Header="Activate Toolbox"
Icon="{Binding Source='pack://application:,,,/SampleBrowser;component/Images/Icons/Toolbox16.png', Converter={StaticResource ImageConverter}}" />
</MenuItem>
</Menu>
</shared:PixelSnapper>
</Grid>
</sampleBrowser:ProductItemControl>