locked
Hyperlink Click event does not fire when inside a ScrollViewer that has scrolled once

    Question

  • In my ebook reader app I very often find lists of chapters expressed as Html links. I am trying to replicate this behaviour in Xaml by using the Hyperlink Click event.

    The book contents is within a RichTextColumns RichTextBlock.

    The RichTextBlock (and its RichTextBlockOverflows) is within a ScrollViewer.

    If the ScrollViewer has never been used for scrolling the Click event of Hyperlinks fires correctly. but after the ScrollViewer has been scrolled once the click event does not fire anymore.

    I have created a small program to demonstrate this behaviour.

    I will be happy to upload the program to anybody who is interested and can help me.

    
    


    • Edited by pmariotti Monday, September 29, 2014 8:40 AM
    Sunday, September 28, 2014 11:10 AM

Answers

  • I have solved the problem with the hyperlink Click event. This had nothing to do with the ScrollViewer being scrolled; the problem was that the first page in a book chapter is a RichTextBlock and the subsequent pages are RichTextBlockOverflows.

    I was treating the RTB differently from the overflows in terms of which events were enabled, and this was causing the Hyperlinks on the overflows to not fire.


    • Edited by pmariotti Wednesday, October 1, 2014 7:30 AM
    • Marked as answer by pmariotti Wednesday, October 1, 2014 7:30 AM
    Wednesday, October 1, 2014 7:30 AM

All replies

  • Please upload the app to OneDrive and share a link to it here.

    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.

    Monday, September 29, 2014 8:48 PM
    Moderator
  • I have solved the problem with the hyperlink Click event. This had nothing to do with the ScrollViewer being scrolled; the problem was that the first page in a book chapter is a RichTextBlock and the subsequent pages are RichTextBlockOverflows.

    I was treating the RTB differently from the overflows in terms of which events were enabled, and this was causing the Hyperlinks on the overflows to not fire.


    • Edited by pmariotti Wednesday, October 1, 2014 7:30 AM
    • Marked as answer by pmariotti Wednesday, October 1, 2014 7:30 AM
    Wednesday, October 1, 2014 7:30 AM