Giter VIP home page Giter VIP logo

wpfmdi's Introduction

WPF Multiple Document Interface (MDI)

[ Migrated from CodePlex 24th November 2017 ]

Project Description

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.

Themes

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.

Using the Control

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

  • Title (e.g. Title="Window 1")
  • Icon (e.g. Icon="MyIcon.png")
  • ShowIcon - Sets whether the icon should be show (e.g. ShowIcon="false" to hide)
  • MinimizeBox - Sets whether the minimize box should be enabled (e.g. MinimizeBox="false" to disable)
  • MaximizeBox - Sets whether the maximize box should be enabled (e.g. MaximizeBox="false" to disable)
  • Resizable - Sets whether the window is resizable (e.g. Resizable="false" to prevent the user from resizing the window)
  • Default FrameworkElement properties - Background, BorderBrush, Margin, Width, Height etc.

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.

wpfmdi's People

Contributors

dutts avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wpfmdi's Issues

windowsFormsHost and Maximize Child

Hello,Richard D dutts
I used your idea in my project,very good! And, i have 2 problems:
1.When I maximize the child window, I create a new window and can't find the shortcut button (maximize, minimize, close).
2.When i use windowsFormsHost in child window, the form control always floats on top of all windows.
I hope you can give me advice.TKS.

Flashing window, Focus loop

Hello I used your class in my project, however I have a problem and I can not solve it. I made a program to open the last windows that were open in the last session of the user. But the program loops in the Focus methods, but the downloaded example opens the windows direct and does not loop, I did the test opening empty windows and it worked, this loop is generated only when I put my controls in, I'm not getting to understand, Has anyone had this problem?

Custom DataChange Property

This is more a question than an issue. I want to send a data-change event to the UserControl/MdiChild from the MDIContainer. The UserControl derived class will have an event-handler or equivalent sort of thing, so just the children that register for the event or create an event handler will be notified. Thank you.

Save position and size

I added some code few years back to save position and size of the widow according to user control added to content. Hopefully I have some time to clean up everything and submit my changes for review.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.