Search code examples
wpfwinformstextboxfindelementhost

WPF - FIND method for TextBox?


After using a Windows Forms RichTextBox, I realized that WPF TextBoxes do not have the .Find Method (as mentioned here). I do not wish to use a WPF RichTextBox as it causes performance issues when I host the element in Windows Forms using HostElement. The WPF TextBox was the way to go in terms of hosting it in Windows Forms

I've heard a lot about Global Search for WPF but I do not wish to implement that feature. Basically what I want is a basic Find method for a WPF textbox. It should consist of a TextBox and a Button. The TextBox is used to enter the string you want to find and the Button should be the command for the Find Method to activate. Each time the user clicks on the Button, the Find method jumps to the next searched result and the next and the next... and act as a loop.

Can someone please help me with this.


Solution

  • I managed to solve the problem by using Regular Expression!