Version

AddDocument Method

Adds a ContentPane to the associated DocumentContentHost
Syntax
'Declaration
 
Public Function AddDocument( _
   ByVal header As Object, _
   ByVal content As Object _
) As ContentPane
public ContentPane AddDocument( 
   object header,
   object content
)

Parameters

header
The value for the System.Windows.Controls.HeaderedContentControl.Header property of the new ContentPane
content
The value for the System.Windows.Controls.ContentControl.Content property of the new ContentPane
Exceptions
ExceptionDescription
System.InvalidOperationExceptionThe Content property must be set to a DocumentContentHost.
Example
This sample demonstrates how to use the AddDocument method to create a new ContentPane within the associated DocumentContentHost and also use the Activate method to ensure the pane contains the keyboard focus.

Imports Infragistics.Windows.DockManager

' this sample assumes you have a XamDockManager whose Content 
' is set to a DocumentContentHost. calling AddDocument when 
' the dockmanager is not using a DocumentContentHost will 
' result in an exception 
Private Sub btnAddDocument_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
    Dim header As Object = "New File"
    Dim content As Object = New RichTextBox()

    ' the AddDocument method will create a new ContentPane for 
    ' the given header & content and put that content pane in 
    ' the tabgrouppane containing the active pane or a new 
    ' tabgrouppane if there aren't any available 
    Dim newDocument As ContentPane = Me.dmForAddDocument.AddDocument(header, content)

    newDocument.AllowDocking = False
    newDocument.AllowFloatingOnly = False

    ' the adddocument method doesn't automatically activate the pane 
    ' in case you wanted to add multiple panes 
    newDocument.Activate()
End Sub
using Infragistics.Windows.DockManager;

// this sample assumes you have a XamDockManager whose Content
// is set to a DocumentContentHost. calling AddDocument when 
// the dockmanager is not using a DocumentContentHost will 
// result in an exception
private void btnAddDocument_Click(object sender, RoutedEventArgs e)
{
	object header = "New File";
	object content = new RichTextBox();

	// the AddDocument method will create a new ContentPane for
	// the given header & content and put that content pane in 
	// the tabgrouppane containing the active pane or a new 
	// tabgrouppane if there aren't any available
	ContentPane newDocument = this.dmForAddDocument.AddDocument(header, content);

	newDocument.AllowDocking = false;
	newDocument.AllowFloatingOnly = false;

	// the adddocument method doesn't automatically activate the pane
	// in case you wanted to add multiple panes
	newDocument.Activate();
}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also