This project is read-only.

DockableContent in FloatingWindow state doesn't size correctly

Apr 24, 2009 at 10:00 PM
Edited Apr 24, 2009 at 11:07 PM

I have to create windows  dynamically.

1/ I  add a grid to a dockableContent and then show the dockableContent in a FloatingWindow state when I click a button.
If I don't add any content to the dockableContent I have no size problem. But when I add a grid a very little window appears. I tried to play with the Width or Height properties but it doesn't change anything.

What am I doing wrong?
Please see the short following code.

2/ Why the Anchor property of the dockablePane is read-only? As a consequence, how can I set the anchor place of a dockablePane created dynamically?


Xaml code:

<Window x:Class="AvalonDock.Tutorials.Window1"
    Title="Window1" Height="600" Width="600" xmlns:xcdg="">
        <ad:DockingManager x:Name="dockManager" Margin="0,33,0,0">
            <ad:ResizingPanel Orientation="Vertical">
                    <ad:DockableContent Title="TextBox2">
                        <TextBox />
        <Button Height="23" Margin="249,4,253,0" Name="button1" VerticalAlignment="Top" Click="button1_Click">Button</Button>

C# code:

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 AvalonDock;
using Microsoft.Research.DynamicDataDisplay;
using Microsoft.Research.DynamicDataDisplay.DataSources;

namespace AvalonDock.Tutorials
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
        public Window1()

        private void button1_Click(object sender, RoutedEventArgs e)
            AvalonDock.DockableContent d = new DockableContent();
            Grid grid = new Grid();
            d.Content = grid;
            dockManager.Show(d, DockableContentState.FloatingWindow);


Apr 25, 2009 at 12:25 AM
My bad, there is no problem 1/. The code works fine if you add elements to your grid.

Can anyone help me on problem 2/ ?

Apr 25, 2009 at 10:49 AM
If I remember right, you can specify the Anchor as a parameter of the DockingManager.Show() method.