Skip to main content

How to: Use the Composite Link

  • 2 minutes to read

This code example demonstrates how to use the CompositeLink class to combine contents of several printing links in a single document.

View Example

Imports System.Collections.Generic
Imports System.Windows
Imports System.Windows.Documents
Imports DevExpress.Xpf.Grid
Imports DevExpress.Xpf.Printing
' ...

Namespace CompositeLinkExample
    ''' <summary>
    ''' Interaction logic for MainWindow.xaml
    ''' </summary>
    Partial Public Class MainWindow
        Inherits Window

        Public Sub New()
        End Sub

        Private Sub printButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
            Dim links As New List(Of TemplatedLink)()
            links.Add(New PrintableControlLink(CType(categoriesGrid.View, TableView)))
            links.Add(New PrintableControlLink(CType(productsGrid.View, TableView)))

            Dim compositeLink As New CompositeLink(links)
            PrintHelper.ShowRibbonPrintPreview(Me, compositeLink)
        End Sub
    End Class
End Namespace

The image below demonstrates the result.