WPF C # Current position of MDIChild?

1

I have implemented a MDIParent with 3 children.

I want to know where the children are but I do not have access to any property, since: child.position is always (0,0).

I have:

<mdi:MdiContainer Name="mdiParent"/>

Code:

this.Child.Title = "ChildLoad";
this.Child.Content = this.ChildView;
this.Child.Height = 260;
this.Child.Width = 320;
this.Child.Resizable = false;
this.Child.MaximizeBox = false;
this.mdiParent.Children.Add(Child);

I can start the child at some point by adding the following code later

this.Child.Position = new Point(300, 300);

But after running the application, child.position is always (0,0) . Even if I move the daughter window.

How do I get the child's current position in MdiParent ?

    
asked by anonymous 28.08.2018 / 16:09

1 answer

1

You can use the PointToScreen method to find out where the MdiChild is:

child.PointToScreen(new Point(0,0))

If you still have difficulty getting the position, you can try from MdiParent :

child.TransformToAncestor(this).Transform(new Point());
    
28.08.2018 / 16:23