ToolWindow unexpectedly opened as RaftingWindow after applying Layout

Docking/MDI for WPF Forum

Posted 10 years ago by Stefan Link
Version: 13.2.0592
Platform: .NET 4.0
Environment: Windows 7 (64-bit)
Avatar

I get some unexpected behavior for opening a ToolWindow that was floating after applying another Layout in which it's located within a SplitContainer within the DockSite.

 

The Code to reproduce (Create a new WPF-Project):

MainWindow.xaml:

<Window x:Class="WpfApplication1.MainWindow"
        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"
        Title="MainWindow" Height="350" Width="525">

    <DockPanel>

        <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal">
            <Button Click="ApplyLayout1" Content="ApplyLayout1" />
            <Button Click="ApplyLayout2" Content="ApplyLayout2" />
            <Button Click="OpenToolWindow2" Content="OpenToolWindow2" />
        </StackPanel>

        <docking:DockSite Name="DockSite">

            <docking:ToolWindowContainer>
                <docking:ToolWindow Title="ToolWindow1" Name="ToolWindow1" />
                <docking:ToolWindow Title="ToolWindow2" Name="ToolWindow2" />
            </docking:ToolWindowContainer>

        </docking:DockSite>
        
    </DockPanel>


</Window>

 MainWindow.xaml.cs:

using System.Windows;
using ActiproSoftware.Windows.Controls.Docking.Serialization;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow
    {
        public MainWindow()
        {
            InitializeComponent();

            _dockSiteLayoutSerializer = new DockSiteLayoutSerializer();
        }

        #region Private methods

        private void ApplyLayout1(object sender, RoutedEventArgs e)
        {
                _dockSiteLayoutSerializer.LoadFromString(LAYOUT1, DockSite);
        }

        private void ApplyLayout2(object sender, RoutedEventArgs e)
        {
                _dockSiteLayoutSerializer.LoadFromString(LAYOUT2, DockSite);
        }

        private void OpenToolWindow2(object sender, RoutedEventArgs e)
        {
            ToolWindow2.Open();
        }

        #endregion

        #region Fields

        private const string LAYOUT1 = 
@"<DockSiteLayout xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" SerializationFormat=""ToolWindowsOnly"">
    <AutoHideHost />
    <Content xsi:type=""SplitContainer"" AutoHideSize=""793,433.04"" DockedSize=""793,433.04"" DocumentSize=""793,433.04"" FloatingSize=""793,433.04"" Size=""793,433.04"" Orientation=""Horizontal"">
        <UIElement xsi:type=""ToolWindowContainer"" AutoHideSize=""793,433.04"" DockedSize=""793,433.04"" DocumentSize=""793,433.04"" FloatingSize=""793,433.04"" Size=""793,433.04"" SelectedWindowUniqueId=""995fea2e-5065-4c7c-88c2-216b1753300b"">
            <UIElement xsi:type=""ToolWindowRef"" UniqueId=""995fea2e-5065-4c7c-88c2-216b1753300b"" />
        </UIElement>
        <UIElement xsi:type=""ToolWindowContainer"" AutoHideSize=""394,433.04"" DockedSize=""394,433.04"" DocumentSize=""394,433.04"" FloatingSize=""394,433.04"" Size=""394,433.04"">
            <UIElement xsi:type=""Track"" UniqueId=""b6f17c30-3e83-4694-aa85-9fadc05a111b"" />
        </UIElement>
    </Content>
    <ToolWindows>
        <ToolWindow UniqueId=""995fea2e-5065-4c7c-88c2-216b1753300b"" AutoHideSize=""793,433.04"" DockedSize=""793,433.04"" DocumentSize=""793,433.04"" FloatingSize=""793,433.04"" Size=""793,433.04"" IsOpen=""true"" LastState=""Docked"" Name=""ToolWindow1"" StandardMdiBounds=""0,0,300,200"" State=""Docked"" />
        <ToolWindow UniqueId=""b6f17c30-3e83-4694-aa85-9fadc05a111b"" AutoHideSize=""394,433.04"" DockedSize=""394,433.04"" DocumentSize=""394,433.04"" FloatingSize=""394,433.04"" Size=""394,433.04"" IsOpen=""false"" LastState=""Docked"" Name=""ToolWindow2"" StandardMdiBounds=""0,0,300,200"" State=""Docked"" />
    </ToolWindows>
</DockSiteLayout>";

        private const string LAYOUT2 = 
@"<DockSiteLayout xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" SerializationFormat=""ToolWindowsOnly"">
    <AutoHideHost />
    <Content xsi:type=""SplitContainer"" AutoHideSize=""793,433.04"" DockedSize=""793,433.04"" DocumentSize=""793,433.04"" FloatingSize=""793,433.04"" Size=""793,433.04"" Orientation=""Horizontal"">
        <UIElement xsi:type=""ToolWindowContainer"" AutoHideSize=""793,433.04"" DockedSize=""793,433.04"" DocumentSize=""793,433.04"" FloatingSize=""793,433.04"" Size=""793,433.04"" SelectedWindowUniqueId=""995fea2e-5065-4c7c-88c2-216b1753300b"">
            <UIElement xsi:type=""ToolWindowRef"" UniqueId=""995fea2e-5065-4c7c-88c2-216b1753300b"" />
        </UIElement>
    </Content>
    <RaftingHosts>
        <RaftingHost IsMaximized=""false"" Location=""860,177"" Size=""394,433"" State=""Floating"">
            <Content xsi:type=""ToolWindowContainer"" AutoHideSize=""394,433"" DockedSize=""394,433.04"" DocumentSize=""394,433"" FloatingSize=""394,433"" Size=""394,433"" SelectedWindowUniqueId=""b6f17c30-3e83-4694-aa85-9fadc05a111b"">
                <UIElement xsi:type=""ToolWindowRef"" UniqueId=""b6f17c30-3e83-4694-aa85-9fadc05a111b"" />
            </Content>
        </RaftingHost>
    </RaftingHosts>
    <ToolWindows>
        <ToolWindow UniqueId=""995fea2e-5065-4c7c-88c2-216b1753300b"" AutoHideSize=""793,433.04"" DockedSize=""793,433.04"" DocumentSize=""793,433.04"" FloatingSize=""793,433.04"" Size=""793,433.04"" IsOpen=""true"" LastState=""Docked"" Name=""ToolWindow1"" StandardMdiBounds=""0,0,300,200"" State=""Docked"" />
        <ToolWindow UniqueId=""b6f17c30-3e83-4694-aa85-9fadc05a111b"" AutoHideSize=""394,433"" DockedSize=""394,433.04"" DocumentSize=""394,433"" FloatingSize=""394,433"" Size=""394,433"" IsOpen=""true"" LastState=""Docked"" Name=""ToolWindow2"" RaftingLocation=""860,177"" StandardMdiBounds=""0,0,300,200"" State=""Floating"" />
    </ToolWindows>
</DockSiteLayout>";

        private readonly DockSiteLayoutSerializer _dockSiteLayoutSerializer;

        #endregion
    }
}

 

As long as "ApplyLayout1" is executed the Button "OpenToolWindow2" opens the second ToolWindow beside the first one, as expected.

But once "ApplyLayout2" is executed (in that Layout ToolWindow2 is a RaftingWindow), applying the first Layout has no real Effect on ToolWindow2. The window gets opened as a RaftingWindow with (seems for me) a default location.

Is there a possible way I can get Layout1 work as expected again?

 

Thanks in advance

Stefan

Comments (1)

Answer - Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Stefan,

Thanks for the sample.  We have fixed this problem for the next maintenance release.


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.