提问人:Anas Ansary 提问时间:9/25/2023 最后编辑:Anas Ansary 更新时间:9/25/2023 访问量:52
如何等待异步图像加载,然后再将其添加到 FixedDocument 进行打印?
How to wait for the async image to load, before adding it to the FixedDocument to print?
问:
代码如下:
MyView myView = new MyView();
MyView.DataContext = datacontext;
FixedPage fixedPage = new FixedPage();
fixedPage.Children.Add(myView);
PageContent pageContent = new PageContent();
((IAddChild)pageContent).AddChild(fixedPage);
FixedDocument fixedDocument = new FixedDocument();
fixedDocument.Pages.Add(pageContent);
PrintDialog printDialog = new PrintDialog();
printDialog.PrintDocument(fixedDocument.DocumentPaginator, "test");
myView 包含以下 XAML 行:
<Image Source="{Binding ImagePath, Mode=OneWay, IsAsync=True}" />
现在,如果我打印 FixedDocument,则图像部分是空的,因为我假设在加载图像之前将视图分配给文档。 除了分配 IsAsync=False 之外,如何解决此问题?
答: 暂无答案
评论
IsAsync