如何在Sliverlight中Print同一页面的两个控件
请教一下,
RT,如何在Sliverlight中Print同一页面的两个控件,这两个控件在不同的父控件里面。
根据各种资料,目前只能打印某个特定的控件,请问下如何才能打印两个(而且它们在不同的父控件里面)呢?
using System.Windows;using System;using System.Collections.Generic;using System.Windows.Printing;using System.Windows.Media;namespace Extensions{ /// <summary> /// Print extension methods /// </summary> public static class ExtensionsPrint { public static void Print(this FrameworkElement element, string Document, HorizontalAlignment HorizontalAlignment, VerticalAlignment VerticalAlignment, Thickness PageMargin, bool PrintLandscape, bool ShrinkToFit, Action OnPrintComplete) { Print(new List<FrameworkElement>() { element }, Document, HorizontalAlignment, VerticalAlignment, PageMargin, PrintLandscape, ShrinkToFit, OnPrintComplete); } public static void Print<T>(this List<T> elements, string Document, HorizontalAlignment HorizontalAlignment, VerticalAlignment VerticalAlignment, Thickness PageMargin, bool PrintLandscape, bool ShrinkToFit, Action OnPrintComplete) { ... } }}
ExtensionsPrint.Print(MyPanel, "MyPanel", HorizontalAlignment.Center , VerticalAlignment.Top , new Thickness(10) , true , true , null);
<Canvas x:Name="MyPanel"> <Grid x:Name="Grid1" > <Grid x:Name="InnerGrid1" Width="200" Height="20" Margin="5" > </Grid> <Grid x:Name="InnerGrid2" Width="200" Height="20" Margin="5" > </Grid> </Grid> <Grid x:Name="Grid2" > </Grid></Canvas>