How to link WPF hyperlink in richtextbox with command?

With the MVVM template, how does the ICommand dynamically bind for the hyperlink click event inside the RichTextBox?

+3
source share
2 answers

These are a few steps to get there, but you can do it.

, FlowDoc

TheDocument.AddHandler(Hyperlink.ClickEvent, 
    new RoutedEventHandler(HandleHyperlinkClick));


//Here the handler definition    
private void HandleHyperlinkClick(object sender, RoutedEventArgs args)
{
    Hyperlink link = args.Source as Hyperlink;
    //...
}

, - . FlowDocuments , , , ViewModel, .

+2

, wpf. (, RichTextBox) , .

. View code , , .

, , ViewModel:

WPF Application Framework (WAF)

http://waf.codeplex.com

+1

Source: https://habr.com/ru/post/1714471/


All Articles