数据绑定到 Microsoft Surface/WPF 中的文档查看器
有没有办法使用文档查看器将多个文档绑定到分散视图,以便它们全部显示?我知道如何对图像执行此操作,但我认为文档查看器的行为有所不同。
我的 XAML 看起来像:
<Grid>
<s:ScatterView Name="Scatter">
<s:ScatterView.ItemTemplate>
<DataTemplate>
<DocumentViewer Name="dvDoc" Margin="0, 20, 0, 0" VerticalAlignment="Top" Height="500" Width="300">
</DocumentViewer>
</DataTemplate>
</s:ScatterView.ItemTemplate>
</s:ScatterView>
</Grid>
但我知道这行不通,因为程序运行时只会创建一个 DocumentViewer 实例。
我的 C# 看起来像:
var d = new DirectoryInfo(@"c:\users\public\documents");
foreach (FileInfo f in d.GetFiles())
{
if (fi.Extension == ".doc")
{
//Look only for .doc files, convert them to XPS so they can be viewed.
}
}
我已经有了 XPS 的转换代码,但我无法确定文件转换后的放置位置。
Is there a way using Document Viewer to bind multiple documents to a scatterview so they all appear? I understand how to do this with images but I think Document Viewer's act diffently.
My XAML looks like :
<Grid>
<s:ScatterView Name="Scatter">
<s:ScatterView.ItemTemplate>
<DataTemplate>
<DocumentViewer Name="dvDoc" Margin="0, 20, 0, 0" VerticalAlignment="Top" Height="500" Width="300">
</DocumentViewer>
</DataTemplate>
</s:ScatterView.ItemTemplate>
</s:ScatterView>
</Grid>
But I know this won't work since only one instance of DocumentViewer will be created when the program is run.
My C# looks like:
var d = new DirectoryInfo(@"c:\users\public\documents");
foreach (FileInfo f in d.GetFiles())
{
if (fi.Extension == ".doc")
{
//Look only for .doc files, convert them to XPS so they can be viewed.
}
}
I have the conversion code to XPS already but I'm having trouble figuring out where to put the files once they've been converted.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从未尝试过,只是一个想法:您是否尝试过使用绑定到 ObservableCollection 的列表框,并且每个 ListItem 都有一个 DocumentViewer?
Never tried and just an idea: have you tried to use a listbox bound to an ObservableCollection with each ListItem having a DocumentViewer?