menu

UWP

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class TextSearchResult - UWP API Reference | Syncfusion

    Show / Hide Table of Contents

    Class TextSearchResult

    Represents the TextSearchResult class.

    Inheritance
    System.Object
    TextSearchResult
    Namespace: Syncfusion.UI.Xaml.RichTextBoxAdv
    Assembly: Syncfusion.SfRichTextBoxAdv.UWP.dll
    Syntax
    public class TextSearchResult : Object

    Properties

    End

    Gets the end TextPosition of the TextSearchResult.

    Declaration
    public TextPosition End { get; }
    Property Value
    Type Description
    TextPosition

    The end TextPosition of the TextSearchResult.

    Start

    Gets the start TextPosition of the TextSearchResult.

    Declaration
    public TextPosition Start { get; }
    Property Value
    Type Description
    TextPosition

    The start TextPosition of the TextSearchResult.

    Text

    Gets the text of the TextSearchResult.

    Declaration
    public string Text { get; }
    Property Value
    Type Description
    System.String

    The text of the TextSearchResult.

    Methods

    Dispose()

    Releases all the resources used by this TextSearchResult instance.

    Declaration
    public void Dispose()

    Replace(String)

    Replaces the TextSearchResult with the specified System.String.

    Declaration
    public int Replace(string replaceText)
    Parameters
    Type Name Description
    System.String replaceText

    The text to replace with.

    Returns
    Type Description
    System.Int32

    Returns one, if the TextSearchResult is replaced successfully with the specified System.String. Otherwise returns zero.

    Remarks

    The replace operation cannot be performed in read only mode.

    Examples

    The following code example demonstrates how to replace an existing text using text search in SfRichTextBoxAdv.

    <RichTextBoxAdv:SfRichTextBoxAdv x:Name="richTextBoxAdv"/>
    public void ReplaceText()
    {
        // Performs case sensitive search for the text "colour" that also matches whole word in the document.
        TextSearchResult textSearchResult = richTextBoxAdv.Find("colour", FindOptions.CaseSensitiveWholeWord);
    
    // If any text search result found, replaces it with the text &quot;color&quot;.
    if (textSearchResult != null)
        textSearchResult.Replace(&quot;color&quot;);
    

    }

    Public Sub ReplaceText()
    
        ' Performs case sensitive search for the text "colour" that also matches whole word in the document.
        Dim textSearchResult As TextSearchResult = richTextBoxAdv.Find("colour", FindOptions.CaseSensitiveWholeWord)
    
        ' If any text search result found, replace it with the text "color".
        If textSearchResult IsNot Nothing Then
            textSearchResult.Replace("color")
        End If
    
     End Sub

    Extension Methods

    DateTimeExtension.ToDateTime(Object)
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved