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 XamlAnd the code behind
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>
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();
}
}
}
}
}