Back to Devexpress

NativeMdiView Class

windowsforms-devexpress-dot-xtrabars-dot-docking2010-dot-views-dot-nativemdi.md

latest5.2 KB
Original Source

NativeMdiView Class

Presents MDI child windows as a native MDI.

Namespace : DevExpress.XtraBars.Docking2010.Views.NativeMdi

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public class NativeMdiView :
    BaseView
vb
Public Class NativeMdiView
    Inherits BaseView

Remarks

MDI child windows can be presented by a DocumentManager either as a native MDI or tabbed UI. To enable a native MDI, create a NativeMdiView object and assign it to the DocumentManager.View property. To use the tabbed UI, create a TabbedView object and assign it to the DocumentManager.View property.

Operations on documents in a NativeMdiView are encapsulated by a INativeMdiViewController object accessible via the NativeMdiView.Controller property.

Example

This example shows how to enable a native MDI for a DocumentManager where MDI child windows are presented as regular windows within a container.

csharp
//Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraBars.Docking2010;
using DevExpress.XtraBars.Docking2010.Views.NativeMdi;
using DevExpress.XtraEditors;

namespace DocumentManager_NativeMDI {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
        }
        int childCount = 0;
        private void Form1_Load(object sender, EventArgs e) {
            CreateDocumentManager();
            for(int i = 0; i < 3; i++) {
                AddChild();
            }
        }
        void CreateDocumentManager() {
            DocumentManager dm = new DocumentManager(components);
            dm.MdiParent = this;
            dm.View = new NativeMdiView();
        }
        void AddChild() {
            Form childForm = null;
            childForm = new Form();
            childForm.Text = "Child Form " + (++childCount);

            SimpleButton btn = new SimpleButton();
            btn.Text = "Button " + childCount;
            btn.Parent = childForm;

            childForm.MdiParent = this;
            childForm.Show();
        }
    }
}
vb
'Form1.vb
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports DevExpress.XtraBars.Docking2010
Imports DevExpress.XtraBars.Docking2010.Views.NativeMdi
Imports DevExpress.XtraEditors

Namespace DocumentManager_NativeMDI
    Partial Public Class Form1
        Inherits Form
        Public Sub New()
            InitializeComponent()
        End Sub
        Private childCount As Integer = 0
        Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
            CreateDocumentManager()
            For i As Integer = 0 To 2
                AddChild()
            Next i
        End Sub
        Private Sub CreateDocumentManager()
            Dim dm As New DocumentManager(components)
            dm.MdiParent = Me
            dm.View = New NativeMdiView()
        End Sub
        Private Sub AddChild()
            Dim childForm As Form = Nothing
            childForm = New Form()
            childCount += 1
            childForm.Text = "Child Form " & (childCount)

            Dim btn As New SimpleButton()
            btn.Text = "Button " & childCount
            btn.Parent = childForm

            childForm.MdiParent = Me
            childForm.Show()
        End Sub
    End Class
End Namespace

Inheritance

Object MarshalByRefObject Component BaseComponent BaseView NativeMdiView

See Also

NativeMdiView Members

View

DevExpress.XtraBars.Docking2010.Views.NativeMdi Namespace