You can use binding for this. Like in this example:
var height = new Binding("ActualHeight") { Source = MdiContainer };
var width = new Binding("ActualWidth") {Source = MdiContainer};
child.SetBinding(FrameworkElement.WidthProperty, width);
child.SetBinding(FrameworkElement.HeightProperty, height);