Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Silverlight 打印包含图像的UserControl?_Silverlight_Xaml_Printing_Silverlight 4.0 - Fatal编程技术网

Silverlight 打印包含图像的UserControl?

Silverlight 打印包含图像的UserControl?,silverlight,xaml,printing,silverlight-4.0,Silverlight,Xaml,Printing,Silverlight 4.0,我实现了上详述的打印机功能,我想我在System.Windows.printing的打印行为中偶然发现了一个bug。我刚刚在布局中添加了一个图像,如下所示: <Grid x:Name="documentRoot"> <Grid.RowDefinitions> <RowDefinition Height="100" /> <RowDefinition Height="25"/> <RowD

我实现了上详述的打印机功能,我想我在System.Windows.printing的打印行为中偶然发现了一个bug。我刚刚在布局中添加了一个图像,如下所示:

<Grid x:Name="documentRoot">
    <Grid.RowDefinitions>
        <RowDefinition Height="100" />
        <RowDefinition Height="25"/>
        <RowDefinition />
        <RowDefinition Height="25"/>
    </Grid.RowDefinitions>
    <Image x:Name="logo" Source="/MyProject;component/Image/logo.jpg" Grid.Row="0" Width="265" Height="51" HorizontalAlignment="Left" Margin="0,0,0,15" VerticalAlignment="Bottom" />
    <TextBlock x:Name="headerTextBlock" Grid.Row="1" HorizontalAlignment="Center" />
    <TextBlock x:Name="bodyTextBlock" Grid.Row="2" TextWrapping="Wrap" />
    <TextBlock x:Name="footerTextBlock" HorizontalAlignment="Center" Grid.Row="3"/>
</Grid>

这段代码的作用是,当应用程序启动后第一次需要打印多个页面时,它将跳过前两个页面,只打印其余页面。如果您再次尝试打印相同的内容,它将按照预期很好地打印页面,直到您重新启动应用程序

请注意,它与添加的行定义无关,因为我试图删除图像元素,但效果非常好。只有当我将Image元素放入我的UserControl时,打印机才会开始发疯

因此,我假设这是微软几年内再也不会费心修复的另一个“小”bug,比如Powershell中的一些其他不工作的标志,我在早期就不得不与之斗争


话虽如此,我还是很高兴在这个问题上被告知错误。但是如果我没有,有人知道解决方法吗?

找到了解决我问题的方法:使用将图像文件转换为XAML画布,然后复制粘贴整个画布代码,而不是我的PrintPage.XAML文件中的图像。尽管这很可怕。我知道