Which code segment should you insert at lines 11 and 12?

You are developing a ticketing application by using Silverlight 4.
You have a listbox named lstTickets that contains a list of the tickets. The page contains a button that allows the user to print the tickets. The PrintView UserControl binds to the type in lstTickets and is designed to fit a standard sheet of paper. You add the following code segment to the button event handler. (Line numbers are included for reference only.)

01 var doc = new PrintDocument();
02 var view = new PrintView();
03 doc.PrintPage += (s, args) =>
04 {
05 var ppc = doc.PrintedPageCount;
06 if (ppc < lstTickets.Items.Count)
07 {
08 var data = lstTickets.Items[ppc];
09 view.DataContext = data;
10 args.PageVisual = view;
11
12
13 }
14 };
15 doc.Print(“tickets”);

You need to use the Silverlight printing API to print each ticket on its own page. You also need to ensure that all tickets in the listbox are printed.
Which code segment should you insert at lines 11 and 12?

You are developing a ticketing application by using Silverlight 4.
You have a listbox named lstTickets that contains a list of the tickets. The page contains a button that allows the user to print the tickets. The PrintView UserControl binds to the type in lstTickets and is designed to fit a standard sheet of paper. You add the following code segment to the button event handler. (Line numbers are included for reference only.)

01 var doc = new PrintDocument();
02 var view = new PrintView();
03 doc.PrintPage += (s, args) =>
04 {
05 var ppc = doc.PrintedPageCount;
06 if (ppc < lstTickets.Items.Count)
07 {
08 var data = lstTickets.Items[ppc];
09 view.DataContext = data;
10 args.PageVisual = view;
11
12
13 }
14 };
15 doc.Print(“tickets”);

You need to use the Silverlight printing API to print each ticket on its own page. You also need to ensure that all tickets in the listbox are printed.
Which code segment should you insert at lines 11 and 12?

A.
if (args.HasMorePages == false)
return;

B.
if (args.HasMorePages == true) return;

C.
if (doc.PrintedPageCount < this.lstTickets.Items.Count 1)
args.HasMorePages = true;

D.
if (ppc == this.lstTickets.Items.Count 1)
doc.EndPrint += (o, p) => { return; };



Leave a Reply 0

Your email address will not be published. Required fields are marked *