Table of Contents

Property HyperText

Namespace
Alternet.Editor.Wpf
Assembly
Alternet.Editor.Wpf.v9.dll

HyperText

Represents object that implements IEditHyperText interface allowing to customize appearance and behavior of hypertext sections within the control.

[Browsable(false)]
public virtual IEditHyperText HyperText { get; }

Property Value

IEditHyperText

Examples

Here is how to use a HyperText in the C# code:

public partial class MainWindow : Window
{
    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        var textEditor = new Alternet.Editor.Wpf.TextEditor();
        textEditor.HyperText.HighlightHyperText = true;
        textEditor.HyperText.JumpToUrl += new Alternet.Editor.Wpf.UrlJumpEvent(this.SyntaxEdit1_JumpToUrl);
    }

    private void SyntaxEdit1_JumpToUrl(object sender, Alternet.Editor.Wpf.UrlJumpEventArgs e)
    {
        MessageBox.Show(e.Text);
        e.Handled = true;
    }
}

Here is how to use a HyperText in the Visual Basic code:

Partial Public Class MainWindow

    Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
        Dim textEditor = New Alternet.Editor.Wpf.TextEditor()
        textEditor.HyperText.HighlightHyperText = True
        AddHandler textEditor.HyperText.JumpToUrl, New Alternet.Editor.Wpf.UrlJumpEvent(AddressOf Me.SyntaxEdit1_JumpToUrl)
    End Sub

    Private Sub SyntaxEdit1_JumpToUrl(ByVal sender As Object, ByVal e As Alternet.Editor.Wpf.UrlJumpEventArgs)
        MessageBox.Show(e.Text)
        e.Handled = True
    End Sub
End Class

Remarks

By default, the TextEditor control highlights some parts of the text, such as HTTP or FTP links, as hypertext.

Use HyperText property to specify which code should be recognized as hypertext and provide custom action when the user clicks on it.