Search Results for

    Show / Hide Table of Contents

    Creating a DocumentWindow

    This example provides information on creating document windows in RobotStudio.

    Note

    For WPF or Windows Forms support, add <UseWPF>true</UseWPF> or <UseWindowsForms>true</UseWindowsForms> to the <PropertyGroup> element in the project file.

    Tip

    For adding a WPF control in a DocumentWindow, it must be hosted in an ElementHost.

    Solution

    1. Create empty <xref:System.Windows.Forms.Control>

      Control control = new Control();
      
    2. Create DocumentWindow using empty Control

      DocumentWindow window = new DocumentWindow(Guid.NewGuid(), control, "MyDocumentWindow");
      UIEnvironment.Windows.Add(window);
      

    Example

    This example provides information on creating document windows in RobotStudio.

    public void AddDocumentWindow()
    {
        // Begin UndoStep
        Project.UndoContext.BeginUndoStep("AddDocumentWindow");
    
        try
        {
            // Initialize a new control and document window, then add to UI.
            Control control = new Control();
            DocumentWindow window = new DocumentWindow(Guid.NewGuid(), control, "MyDocumentWindow");
            UIEnvironment.Windows.Add(window);
        }
        catch
        {
            Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
            throw;
        }
        finally
        {
            Project.UndoContext.EndUndoStep();
        }
    }
    

    Required Namespaces

    ABB.Robotics.RobotStudio.Environment

    See Also

    • Creating ToolWindow
    In this article
    Back to top Copyright © 2026 ABB Robotics