Clicking HyperLinks in a RichTextBox without holding down CTRL - WPF

后端 未结 6 1102
鱼传尺愫
鱼传尺愫 2020-11-30 11:35

I have a WPF RichTextBox with isReadOnly set to True. I would like users to be able to click on HyperLinks contained within the RichTextBox, withou

6条回答
  •  孤城傲影
    2020-11-30 11:55

    I changed EventSetter from @hillin's answer. MouseLeftButtonDown didn't work in my code (.Net framework 4.5.2).

    
    
    private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
    {
        Process.Start(e.Uri.ToString());
    }
    

提交回复
热议问题