简体   繁体   English

如何在内容模型控件上使用FixedPage标记?

[英]How to I use FixedPage markup on a Content Model control?

In WPF, I have tried passing the mark-up of an XPS file's FixedPage to a control that has the Content property (ex. Button.Content = XamlReader.Load(<FixedPage markup>) ). 在WPF中,我尝试过将XPS文件的FixedPage的标记传递给具有Content属性(例如Button.Content = XamlReader.Load(<FixedPage markup>) )的Button.Content = XamlReader.Load(<FixedPage markup>)

Example of FixedPage markup: FixedPage标记示例:

<FixedPage Width="816" Height="1056" xmlns="http://schemas.microsoft.com/xps/2005/06" xml:lang="und">
    <Path Data="M 115.52,132.48 L 704.64,132.48 704.64,908.96 115.52,908.96 z" Clip="M 0,132.32 L 0,908.8 816,908.8 816,132.32 z">
        <Path.Fill>
            <ImageBrush ImageSource="/Documents/1/Resources/Images/1.JPG" Viewbox="0,0,809.333,1066.67" TileMode="None" ViewboxUnits="Absolute" ViewportUnits="Absolute" Viewport="115.52,132.48,589.12,776.48" />
        </Path.Fill>
    </Path>
</FixedPage>

The control was not able to get the resource referred to in the FixedPage mark-up. 控件无法获取FixedPage标记中引用的资源。

ImageSource="/Documents/1/Resources/Images/1.JPG"

But if I change the ImageSource to a local path file like "c:\\1.jpg" and put the resource file in the same location, the control will be able to display the FixedPage mark-up. 但是,如果我将ImageSource更改为本地路径文件,例如“ c:\\ 1.jpg” ,并将资源文件放在相同的位置,则控件将能够显示FixedPage标记。

My question is, is there a way for the control to display the FixedPage while retaining the relative URI of the resource in order to avoid modifying the FixedPage mark-up? 我的问题是,控件是否有一种方法可以在显示固定页面的同时保留资源的相对URI,以避免修改固定页面标记? Like mapping the XPS file's structure in memory and then setting the BaseUri of the FixedPage markup by the ParserContext class during the call to XamlReader.Load() ? 像映射XPS文件在内存中的结构,然后设置BaseUri由固定页面标记的ParserContext在通话过程中类XamlReader.Load() Is this possible? 这可能吗?

Probably not. 可能不会。 Even if the ImageBrush can work with the PackageStore, the URI is malformed; 即使ImageBrush可以与PackageStore一起使用,URI的格式也仍然不正确。 its missing the root of the XPS Document in the package store. 它缺少软件包存储中XPS文档的根。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM