views:

501

answers:

1

Hello!

In WPF, I have tried passing the markup of an XPS file's FixedPage to a control that has the Content property (ex. Button.Content = XamlReader.Load()).

Example of FixedPage markup:

<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 markup.

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 markup.

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 markup? 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()? Is this possible?

Thanks!

BJ

A: 

Probably not. Even if the ImageBrush can work with the PackageStore, the URI is malformed; its missing the root of the XPS Document in the package store.

Will