Arrange Child window

May 25, 2010 at 11:57 AM

Hello,

If there are 4 or more child window in the MdiContainer, Is there a way to arrange the chldren window into grid layout?

Thanks.

 

Sep 21, 2010 at 9:03 PM

Hi,
I have a similar question. I would like to choose where on the screen a new window should be opend. If I use this:

Container.Children.Add(new MdiChild()
            {
                Title = "Window Using Code",
                Content = new ExampleControl(),
                Margin = new Thickness(300,300,0,0),
            });

That would make the window open up okey but if I maximize it and the restore it it will not remember the position.
I think I need to set the Canvas.Left option. I looks like this in xaml:

<mdi:MdiChild Title="Empty Window Using XAML" Canvas.Top="300" Canvas.Left="300" />
How do I set that using code?

Dec 10, 2010 at 6:33 PM
Edited Dec 11, 2010 at 5:51 AM

Overdrive7

Add following code to MdiChild.cs:

 

/// <summary>
/// Gets or sets position of window inside container.
/// Point indicates top left corner of window.
/// </summary>
public Point Position
{
    get { return new Point { X = Canvas.GetLeft(this), Y = Canvas.GetTop(this) }; }
    set
    {
        Canvas.SetLeft(this, value.X < 0 ? 0 : value.X);
        Canvas.SetTop(this, value.Y < 0 ? 0 : value.Y);
    }
}

This will be included in next release as DependencyProperty.