Property MatchingBlocks
MatchingBlocks
Gets or sets IRangeList
of matching begin/end blocks for Edit control.
[Browsable(false)]
public virtual IRangeList MatchingBlocks { get; set; }
Property Value
Examples
Here is how to use a MatchingBlocks in the C# code:
using System;
using System.Windows;
using Alternet.Editor.Wpf;
public partial class MainWindow : Window
{
private TextSource textSource;
private void Window_Loaded(object sender, RoutedEventArgs e)
{
var textEdit1 = new TextEditor();
textSource = new TextSource();
textSource.LoadFile("myfile.txt");
textSource.HighlightMatchingBlocks = true;
textEdit1.Source = this.textSource;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show(textSource.MatchingBlocks.Count.ToString());
}
}
Here is how to use a MatchingBlocks in the Visual Basic code:
Imports System
Imports System.Windows
Imports Alternet.Editor.Wpf
Partial Public Class MainWindow
Inherits Window
Private textSource As TextSource
Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim textEdit1 = New TextEditor()
textSource = New TextSource()
textSource.LoadFile("myfile.txt")
textSource.HighlightMatchingBlocks = True
textEdit1.Source = Me.textSource
End Sub
Private Sub Button_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
MessageBox.Show(textSource.MatchingBlocks.Count.ToString())
End Sub
End Class
Remarks
Use MatchingBlocks to determine the position of the matching blocks (such as "Class" with "End Class" in Visual Basic) as the user navigates through the text.
Set HighlightMatchingBlocks property is set to true to enable highlighting of the matching blocks.