Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9235351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:00:36+00:00 2026-06-18T07:00:36+00:00

I am programming a Silverlight application using Lightswitch. I want to print the data

  • 0

I am programming a Silverlight application using Lightswitch. I want to print the data which is displayed on some screens.

I found this tutorial for printing in Silverlight/Lightswitch. It describes how to create a custom control using XAML which can be printed. The control looks like this:

Printing in Lightswitch

In the background you can see the control how it looks like in the Silverlight application. The control contrains both a button and a grid:

<StackPanel>
    <Button Content="Print" Name="btnPrint" Click="btnPrint_Click" />
        <Grid x:Name="LayoutRoot">
            <!-- grid code goes here -->
            <!-- some more code an closing tags -->

Using Silverlight’s printing API, printing is done like this in the custom control:

PrintDocument printInvoice = new PrintDocument();
private void btnPrint_Click(object sender, System.Windows.RoutedEventArgs e){   
    printInvoice.PrintPage +=
        new EventHandler<PrintPageEventArgs>(printInvoice_PrintPage);
}

void printInvoice_PrintPage(object sender, PrintPageEventArgs e){
    e.PageVisual = LayoutRoot;
}

Since e.PageVisual = LayoutRoot is used, we only see the table in the printed output, and not the button. That’s okay, but I would like to use a seperate XAML for the print layout. My goal is to just show a button Print on the Silverlight application, and define the print layout in a seperate XAML.

So, I just started to create a second XAML as SilverlightControl and tried to use it:

MyPrintLayout mpl = new MyPrintLayout();
void printArtikels_PrintPage(object sender, PrintPageEventArgs e){
    e.PageVisual = mpl.LayoutRoot;
}

But I get the error “Das Element ist bereits das untergeordnete Element eines anderen Elements” (english: “The element is already the sub-element of another element”). This error was discussed in this question as well, but it does not solve my problem.

When I include MyPrintLayout in the silverlight application it is displayed without a problem (there is only some text in it to test the functionality).

It seems like I am doing this completely wrong. How can I achieve my goal?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T07:00:38+00:00Added an answer on June 18, 2026 at 7:00 am

    mpl.LayoutRoot already sub-element of mpl.
    Try this:

    void printArtikels_PrintPage(object sender, PrintPageEventArgs e){
        MyPrintLayout mpl = new MyPrintLayout();
        e.PageVisual = mpl;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently programming an application in Silverlight which need to have a control to
My team (3 developers) will be building a Silverlight LOB application. This is the
I have recently been programming Web based applications using Silverlight & Ria Services. I
I am new to WP7 programming and I have been following this tutorial http://weblogs.asp.net/scottgu/archive/2010/03/18/building-a-windows-phone-7-twitter-application-using-silverlight.aspx
I have a silverlight application which kicks off a number of jobs on the
I'm fairly new to Silverlight. I have an AutoCompleteBox which is filled with Data
I wrote a whole bunch of class libraries for silverlight. I want another programming
Silverlight has been available since quite some time, and Silverlight 2 allows .Net programming
I am already familiar with Silverlight programming but not have any experience with GIS.
I'm new to silverlight and wpf programming I've just created a simple storyboard in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.