Silverlight / WPF - Print Generic List values in Silverlight

Asked By gopal krish on 21-Jun-12 07:55 AM
Earn up to 10 extra points for answering this tough question.
hi..

i need to Print Generic List values in Silverlight?

need ur suggestions with examples..

regards
gopal.s
[)ia6l0 iii replied to gopal krish on 21-Jun-12 10:29 PM
If you have Silverlight version 3, you cannot. You have to custom write the objects or render them as bitmap's I guess.

In Silverlight version 4, the PrintDocument class was introduced. Well, I hope you have not scoured the holy internet yet for any articles. David Poll had this article titled "Making printing easier in Silverlight 4" on his blog much much earlier. Here is the link from my bookmarks - http://www.davidpoll.com/2010/04/16/making-printing-easier-in-silverlight-4/

In short,  you need to create a print document, give it a name. Associate the PrintPage handler and in the handler , add the elements to the pageRoot children. And then call the print method.

var pd = new PrintDocument();
pd.DocumentName = "custom print";
pd.PrintPage += pd_PrintPage;
pd.Print();

private void pd_PrintPage(object sender, PrintPageEventArgs e)
{
    var pageRoot = new Canvas();
    e.PageVisual = pageRoot;
    pageRoot.Children.Add(control1);

}


Hope it helps.
Vikram Singh Saini replied to gopal krish on 23-Jun-12 05:06 AM
The author at link  http://www.thomasclaudiushuber.com/blog/2009/12/10/how-to-print-a-liststring-in-silverlight-4-beta-over-multiple-pages/  suggests how to print List values of type string in silverlight. The code has been provided by author and explained very well.

Here is the link for downloading entire source code: http://www.thomasclaudiushuber.com/dotnet/20091210_ThomasClaudiusHuber_PrintStringListInSilverlight4Beta.zip

Hope the links would help you to understand all.
help
Hello, We have an SL5 application and the client wants the browser print button to be disabled, or in some other way ensure that the user cannot print the page. Does anyone know if this is possible? need ur suggestions. . regards gopal.s You can do it with CSS - but- -- <style type = "text / css" media = "print"> BODY {display:none;visibility:hidden;} < / style> Anybody can still deafeat it using Print Screen Hi Gopal, try the below mentioned codes: < div id = "silverlightObjDiv" > < / div > Javascript <script> document onkeypress = "return disableCtrlKeyCombination(event);" onkeydown = "return disableCtrlKeyCombination(event);"> By my knowledge you can not disable print button of browser because it is browser functionality, We can access browser information but you can not set setting for browser, keywords: Silverlight, WPF, Restrictions, Registry, Array, Hi Gopal, Disable, Print, Click description: Disable browser print button Hello
1. Is there a way in Silverlight 4 or 5 to determine what types of printing one's printer supports (vector / bitmap way to get more than just a user's local installed printers when attempting to print a doc. Others show up but we can only access the users local printers. Thanks you use the PrinterFallBackSettings - And set the ForceVector bool property to true , and perform a print operation - it should be able to let you know if the printer supports vector or printing.printerfallbacksettings(v = vs.95).aspx Hope this helps. Thanks! So what about attempting to print many pages in SL 4 and the bitmap size gets huge and gets hung in the print que? Andrew Have you used the PrintDocument class to do the multi-page printing? Please that the SL engine converts the printable pages to bitmaps and it takes forever to print. I know SL 5 has an option for postscript / vector printing but that is not
What is the best way to print set of xml files with associated XSLT to printer? I would like to know if it is possible through asp.net (or silverlight)? Thanks, C# Discussions Silverlight (1) ASP.NET (1) Print (1) XSLT (1) XML (1) If you want to know about ASP.NET or Silverlight, you need to post to a forum where questions about those technologies is on-topic there remains the question of how to interpret the output for that. You can easily print out the literal output but, for example, that might just be HTML that really should post it in ASP.Net and take your advice and refine the statement more. keywords: Print, XML, suggestion description: What is the best way to print set of xml files with
Hi, Iam Creating silverlight project.In this project creating invoice Report.In runtime i clicked print for invoice It is automatically save in database and print the current Invoice. call the save method in print operation it does not working. public void Print(object obj) { try { int InvoiceId = Convert.ToInt32(_currentInvoice.DisplayNumber); if (InvoiceId ! = 0) { MessageBox.Show("You must save your chabges befor you print this.Do you want to save your changes now", App.ApplicationTitle, MessageBoxButton.OK); SaveMethod(); SaveInvoice rw.Show(); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), App.ApplicationTitle, MessageBoxButton.OK); } } public void Print(object obj) { try { int InvoiceId = Convert.ToInt32(_currentInvoice.DisplayNumber); if (InvoiceId ! = 0) { MessageBox.Show("You
I want to Print the Reports in Silverlight.(the Reports should be exported to the Excel or Pdf and the reports should be reports Should be the way user wants hello, here is the link for reports in silverlight http: / / 10rem.net / blog / 2010 / 05 / 09 / creating-a-simple-report-writer-in-silverlight-4 hope this will help you Since Silverlight 2 is not capable of any APIs which are printer specific, it is developer responsibility to determine how you can handle printing. Generally, if you are printing in either Silverlight or any web application, there are two key options for the user. One is printing about using server side report printing however is because the user needs to click separate print buttons from the application in order to open the report. If this is neglected and
Hi, Im very new to silverlight. How we can fetch data from sql server and binding to silverlight grid. . Please help me in this regard. Thanks. HI refer this example http: / / www.codeproject com / KB / silverlight / Silverlight3_SQL_WCF.aspx HI here is the example The DataGrid image refer the link for details http: / / odetocode.com / code / 740.aspx Introduction Silverlight 3 is by far, the coolest technology for web programming! I’m so excited about Silverlight 3! I hope I can share some things with you here that will help you get up and running with Silverlight 3 and SQL Server Data bases. This article walks you through displaying data from an
Hi all, how to print all the listview contents if there is a scrollbar? Image shown below is the one we wanted to print but it does not print all the contents. The following codes the one we used: private void btnPrint_Click( object sender RoutedEventArgs e) { PrintDialog print = new PrintDialog (); if (print.ShowDialog() = = true ) { print.PrintVisual(lstProduct, "Print Summary Report" ); } } Image: it looks like you need to create a Fixed
Use the Report object to print the XamDataGrid The sample code belows shows the user of Report object to print a XamDataGrid Report rptObject = new Report(); rptObject.ReportSettings.Margin = new Thickness(10, 10, 10, 10 EmbeddedVisualReportSection sectionGrid = new EmbeddedVisualReportSection(xamDataGrid1); rptObject.Sections.Add(sectionGrid); rptObject.Print(true, false); Related FAQs PrintPreview a XamDataGrid Use the Report object to print preview the XamDataGrid Print a XamDataGrid ( 1094 Views ) keywords: ReportXamDataGrid, XAML, WPF, print, Section description: Use the Report object to print the XamDataGrid
This article shows some ways on how to print and preview documents using WPF. Introduction I was searching on how to print using WPF for my application. The requirement is that there’s already a background image also be previewed. So while searching, I found out that there are several ways to print documents using WPF. Let’s start with the easy ones. Printing a Visual A Visual the contents of the window. The following code listing shows the event handler for the Print button’s Click event. private void PrintBtn_Click( object sender, RoutedEventArgs e) { PrintDialog printDialog = new PrintDialog (); if (printDialog.ShowDialog() = = true ) { printDialog.PrintVisual(grid, "My First Print Job" ); } } The PrintDialog control is shown when the Print button is clicked. The PrintDialog lets the user choose a printer, set printer preferences, and other print options. If the user clicks the Print button then the PrintVisual method is executed. What