Setting Window State in WPF Tabbed MDI Form

18 Feb 20251 minute to read

Setting Window State

There are three possible window states of MDI windows for the Document Container control. They are as follows.

  • Maximized
  • Minimized
  • Normal

To set the MDI window state to “minimized”, use the below code snippet. FlowDocumentScrollViewer is considered as an element of the Document Container in the below mentioned example.

  • XAML
  • <!-- Adding Document Container -->
    
    <syncfusion:DocumentContainer Name="DocContainer" Mode="MDI">
    
    <FlowDocumentScrollViewer syncfusion:DocumentContainer.MDIWindowState="Minimized" >
    
    </FlowDocumentScrollViewer>
    
    …....
    
    …....
    
    </syncfusion:DocumentContainer>

    Displays maximized MDI window

    Notify event for MDIWindow State Changes

    The MDIWindowStateChanging event occurs before the state of the MDIWindow is changed. The state changing of MDIWindow can be handled by setting e.Cancel to true.

    <syncfusion:DocumentContainer Name="DocContainer" Mode="MDI" MDIWindowStateChanging="DocContainer_MDIWindowStateChanging">
    
    <FlowDocumentScrollViewer syncfusion:DocumentContainer.Header="Window1" >
    
    </FlowDocumentScrollViewer>
    <FlowDocumentScrollViewer syncfusion:DocumentContainer.Header="Window2" >
    
    </FlowDocumentScrollViewer>
    
    </syncfusion:DocumentContainer>
    private void DocContainer_MDIWindowStateChanging(object sender, MDIWindowStateChangingEventArgs e)
            {
                if (e.NewState == MDIWindowState.Maximized)
                    e.Cancel = true;
            }