November 04, 2011
1: on my mainpage.xmal I taken Data grid with Check box selection and Canvas.
2: I want to print Selected record on Canvas but it is not printing it give a exception error,
i.e Dialogs must be user-initiated.(Security Exception was unhanded by user) following code i do but it not working properly pl help me to do this.
private void btnPrint_Click(object sender, RoutedEventArgs e)
int count = 0;
int printCount = 0;
PrintDocument docToPrint = new PrintDocument();
foreach (ServiceReference1.DDDEMO dd in obcDDDemo)// here DDDEMO is table and "obcDDDemo" is ObservableCollection class.
textBlock1.Text =dd.Name.ToString(); //Payee name.
docToPrint.PrintPage += (s, args) =>
args.PageVisual = canvas1;
if (printCount < count)
args.HasMorePages = true;
args.HasMorePages = false;