A library to add the traditional Windows Forms Multiple Document Interface (MDI) features to WPF. The aim is to resemble the original as much as possible.
WPF MDI includes two themes, Luna (XP) and Aero (Vista & 7) as well as support for custom themes. Themes are used depending on the operating system, although a theme can be set at compile and/or run time also.
The control supports both XAML and code use.
To use the control in XAML, add the dll as a reference in the project and add the following line to the top of your XAML file underneath the xmlns declarations
xmlns:mdi="clr-namespace:WPF.MDI;assembly=WPF.MDI"
To create a container add the following code, it works much like a grid or panel does
<mdi:MdiContainer></mdi:MdiContainer>
Optionally, you could specify a theme here too
<mdi:MdiContainer Theme="Aero"></mdi:MdiContainer>
To add a child to the container, add an MdiChild control inside the MdiContainer
<mdi:MdiContainer Theme="Aero">
<mdi:MdiChild />
</mdi:MdiContainer>
Properties here which can be used are
For example, the following will set the title of the window to Window 1, prevent the user from resizing the window, disable the minimize button and make the background of the window dark gray
<mdi:MdiContainer Theme="Aero">
<mdi:MdiChild Title="Window 1" Resizable="False" MinimizeBox="False" Background="DarkGray" />
</mdi:MdiContainer>
Inside the MdiChild element you can specify content such as a custom made user control or create a grid and place all of your control inside the window
<mdi:MdiContainer Theme="Aero">
<mdi:MdiChild Title="Window 1" Resizable="False" MinimizeBox="False" Background="DarkGray">
<Grid>
<ListBox Margin="12,36,12,12" Name="listBox1" />
<Button Height="23" HorizontalAlignment="Right" Margin="0,7,12,0" Name="button1" VerticalAlignment="Top" Width="75">Button</Button>
<TextBox Height="23" Margin="12,7,93,0" Name="textBox1" VerticalAlignment="Top" />
</Grid>
</mdi:MdiChild>
</mdi:MdiContainer>
To use code to create add windows, create your MdiContainer in the XAML as previously explained, name it something appropriate such as WindowContainer and use the Children list to add windows
WindowContainer.Children.Add(new MdiChild()
{
Title = "Window 1"
});
To add controls, use the Content property
WindowContainer.Children.Add(new MdiChild()
{
Title = "Window 1",
Content = new ExampleControl()
});
For more examples, check out the Examples folder in the repo.