I am working on a (WPF + C#) application. I have to implement search functionality. It will allow to search all the occurrences of a particular string on the specific part of Window. What can be the best way to do this?
+2
A:
Viky,
I hope I got you properly. You can take a look on what Kent Boogaart has: Search and Highlight Text in an Arbitrary Visual Tree:
Anvaka
2010-06-15 13:34:14
@Anvaka: thanks for the reply its really helpful, but my window can contain other controls as well. like TextBox, ComboBox, i need to search Text in them also. Any suggestions?
viky
2010-06-16 14:30:51
@Viky, as long as it's in the visual tree it should work (TextBoxes should work). As for the ComboBox... it's little trickier, because items in the drop down list are in popup's visual tree. In that case you would probably have to customize Kent's algorithm to check against "known" exceptions.
Anvaka
2010-06-16 18:31:09
A:
Hi,
You should try using ICollectionView for filtering. Here is an example.
decyclone
2010-06-15 19:36:29