locked
Using Hyperlink element for internal navigation in a RichTextBlock RRS feed

  • Question

  • Hi everyone,

    I have a RichTextBlock that I am stuffing with some parsed HTML text that I'm using for a simple e-reader/reference application that has footnote/reference links associated with the main text body. I am parsing out the references of my books, and have the links which I want to manage myself. If I create a hyperlink element to footnotes in my RichTextBlock, I have to specify a URI. Can I form a URI that would allow ME to handle the link instead of Windows?

    Right now if I specify a URI in the hyperlink object, the system automatically wants to launch either a browser with the URL, or tell me that I need to have an app that can handle the URI passed in (I wanted to create my own URI to handle internal navigation).

    Effectively, when the user clicks on the hyperlink, I want it to have the text of the reference pop up (it's a Bible study sort of application, and these would be Scripture references).

    Thanks for any pointers that you might have. I am new to Windows 8 store app development, and the .NET framework as a whole, but up to this point everything has been pretty great!

    Best,
      Rom

    Tuesday, December 17, 2013 1:11 PM

Answers

  • Two ways:1) See How to handle URI activation for how to define your app to handle custom URIs.

    2) Handle the Hyperlink.Click event to stay purely internal to the app.

    --Rob

    • Marked as answer by romeshp Tuesday, December 17, 2013 7:25 PM
    Tuesday, December 17, 2013 4:13 PM
    Moderator

All replies

  • Here's what you need to know:

    http://msdn.microsoft.com/en-us/library/windows/apps/hh452686.aspx


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, December 17, 2013 4:11 PM
    Moderator
  • Two ways:1) See How to handle URI activation for how to define your app to handle custom URIs.

    2) Handle the Hyperlink.Click event to stay purely internal to the app.

    --Rob

    • Marked as answer by romeshp Tuesday, December 17, 2013 7:25 PM
    Tuesday, December 17, 2013 4:13 PM
    Moderator
  • Thanks everyone who responded - what I did was handled the Click event, and removed the NavigateUri property, so that I handled it all internally. I created a dictionary of my hyperlinks to my internal reference strings and that seems to work great!

    It seems so obvious in retrospect. Thanks!

    Tuesday, December 17, 2013 7:27 PM