user2551669
user2551669

Reputation:

How to pass a link URI from a XPS document to wpf app?

is there a way to retrieve/catch a link URI in xps document that opened in a wpf application document viewer? I'm using a document viewer control to open xps file:

  <Grid>
    <DocumentViewer x:Name="docview" HorizontalAlignment="Left" VerticalAlignment="Top">
        <FixedDocument/>
    </DocumentViewer>
</Grid>

then there is a link in the Opened Document like the blue underlined text in picture:
picture of viewer and opened document

I like the event of clicking the link begin handheld by my custom event handler.

Upvotes: 1

Views: 225

Answers (1)

Cesario
Cesario

Reputation: 172

What about:

<Grid>
    <Grid.Resources>
        <Style TargetType="Hyperlink">
            <Style.Setters>
                <EventSetter Event="Click" Handler="OnClickHyperlinkElement" />
            </Style.Setters>
        </Style>
    </Grid.Resources>
    <DocumentViewer x:Name="docview" HorizontalAlignment="Left" VerticalAlignment="Top">
        <FixedDocument/>
    </DocumentViewer>
</Grid>

Upvotes: 1

Related Questions