Hello,
I am trying to insert a new tool window into an existing layout (defined using XAML).
The base layout is very simple. In the middle, there is a workspace. Left to the workspace, there is just one tool window container (container 1) containing one tool window (window 1). The described setting has been defined using XAML. It is working.
Now, I want to dock a new tool window (window 2) programmatically to the bottom of the existing window 1. The new window should be initialized with a static height of 200 points.
As I read in this forum, it is not possible to apply a preferred height directly to the window, but only to an window container. Therefore, I decided to create a new window container, applying the preferred height, adding the new window as a child and finally docking the window container to window 1:And the XAML Code defining the base layout:
Please tell me what I am doing wrong. Running the code above shows that my programmatic operations do not take any effect. The new window 2 is not visible at all, neither with the correct nor with any height.
Sincerely,
Robert
[Modified at 05/13/2011 11:06 PM]
I am trying to insert a new tool window into an existing layout (defined using XAML).
The base layout is very simple. In the middle, there is a workspace. Left to the workspace, there is just one tool window container (container 1) containing one tool window (window 1). The described setting has been defined using XAML. It is working.
Now, I want to dock a new tool window (window 2) programmatically to the bottom of the existing window 1. The new window should be initialized with a static height of 200 points.
As I read in this forum, it is not possible to apply a preferred height directly to the window, but only to an window container. Therefore, I decided to create a new window container, applying the preferred height, adding the new window as a child and finally docking the window container to window 1:
public MainWindow()
{
InitializeComponent();
var container2 = new ToolWindowContainer();
var window2 = new ToolWindow();
window2.Title = "Tool Window 2";
window2.Content = new Button { Content = "Content of Window 2" };
container2.Items.Add(window2);
container2.SetValue(DockSite.ControlSizeProperty, new Size(0.0, 200.0));
container2.Dock(window1, Direction.Bottom);
}
<Window xmlns:docking="http://schemas.actiprosoftware.com/winfx/xaml/docking" x:Class="DockingTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="483" Width="680">
<Grid>
<docking:DockSite Name="docksite">
<docking:SplitContainer>
<docking:ToolWindowContainer Name="container1">
<docking:ToolWindow Title="First Tool Window" Name="window1">
First Tool Window Content
</docking:ToolWindow>
</docking:ToolWindowContainer>
<docking:Workspace>
<docking:TabbedMdiHost>
<docking:TabbedMdiContainer>
<docking:DocumentWindow Title="My Document">
My Document Content
</docking:DocumentWindow>
</docking:TabbedMdiContainer>
</docking:TabbedMdiHost>
</docking:Workspace>
</docking:SplitContainer>
</docking:DockSite>
</Grid>
</Window>
Sincerely,
Robert
[Modified at 05/13/2011 11:06 PM]