In silverlight 4.0 the main API for printing is PrintDocument class which lives in System.Windows.Printing namespace. Here are the steps we need to do for a Printing.
1) First Create instance of PrintDocument class.
2) Next Implement the PrintPage event handler and Set PageVisual to the UIElement you want to print.
3) Finally call Print() method.
This is very easy way to print this is same as screen printing.
let see in action
First Create Silverlight application project.
In the Next Dialog box we just say click OK .
now lets add some XAML code to build UI with some Text and try to print them.
Here is my GUI with some sample Contact Lists.
Event handler to handle Printpage event.
Here i am using Lambda Expression (C# 3.0) basically the down rectangle code replaced by the above Rectangle Lambda Expression.
Nandri(Thanks)
SreenivasaRagavan.
No comments:
Post a Comment