Shrinking ToolWindows

Docking/MDI for WPF Forum

Posted 14 years ago by Mark Benda
Version: 9.1.0505
Avatar
Hi,
I have undocked ToolWindows that I open and close depending on the status of my tool window view model. Each time the window is closed then re-opened, the ToolWindow size is shrunken by several pixels.

Here's my example code, every time you click the button to open/close the toolwindow the size gets smaller.
Thanks in adavance!

Here's the Xaml

<Window x:Class="ToolWindowTest.Window1"
    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="Window1" Height="300" Width="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Button Grid.Row="0" Width="Auto" Grid.Column="0" HorizontalAlignment="Left" Click="Button_Click">
            OpenCloseToolWindow
        </Button>
    <DockPanel Grid.Row="1" Grid.ColumnSpan="2">
        <docking:DockSite x:Name="dockSite" UseHostedRaftingWindows="True">
            <docking:SplitContainer>
                    <docking:ToolWindowContainer x:Name="toolWindowContainer"/>
                
                <docking:Workspace>
                    <docking:TabbedMdiHost>
                        <docking:TabbedMdiContainer x:Name="tabbedMdiContainer"/>
                    </docking:TabbedMdiHost>
                </docking:Workspace>
            </docking:SplitContainer>
        </docking:DockSite>
    </DockPanel>
  </Grid>
</Window>

And the code behind

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ActiproSoftware.Windows.Controls.Docking;

namespace ToolWindowTest
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        ToolWindow tw;
        public Window1()
        {
            InitializeComponent();
            tw = new ToolWindow(dockSite, "toolWindow", "Tool Window", null, "Empty Tool Window");
            tw.CanRaft = true;

            tw.Undock();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (tw != null)
            {
                if (tw.IsOpen == true)
                {
                    tw.Close();
                }
                else
                {
                   tw.Open();
                }
            }
        }
    }
}

Comments (1)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Mark,

Thanks for the bug report and sample. We actually found this issue while building Visual Studio 2010 features. This issue will be fixed in that release, which will be after the next maintenance release. We will notify you when it's fixed.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.