Create MdiChild in UserControl or other Xaml?

Jan 20, 2010 at 11:18 PM

There currently doesn't appear to be way a way to create MdiChild outside of the Main.xaml or programmatically like this:

           Container.Children.Add(new MdiChild()
            {
                Title = "NVCLT050 Using Code",
                Content = new ClientProductForm(),
                Width = 714,
                Height = 734,
                Margin = new Thickness(200, 30, 0, 0)
            });

I want to create many different MdiChild windows across different Wpf class library projects to add to the MdiContainer dynamically. Is this something you have thought of - if so, how could it be done? Any hints on what I could try to build it myself?

For example, something like this...? Obviously there would be no designer support, but at least it would be easy to manage the source

<mdi:MdiChild x:Class="StandaloneChild"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mdi="clr-namespace:WPF.MDI;assembly=WPF.MDI"
    Title="Child1">
    <Grid>
        <Button Name="DisableMinimize" Height="20" >Disable Minimize</Button>
        <Button Name="EnableMinimize" Height="20" >Enable Minimize</Button>
        <Button Name="DisableMaximize" Height="20" >Disable Maximize</Button>
        <Button Name="EnableMaximize" Height="20" >Enable Maximize</Button>
        <Button Name="ShowIcon" Height="20" >Show Icon</Button>
        <Button Name="HideIcon" Height="20" >Hide Icon</Button>
    </Grid>
</mdi:MdiChild>