I have a listbox and I display incremental search result in it based on the text changed event of a textbox, everytime I update the listboxitemsource. The items displayed inside a listbox the text of it must be highlighted.
Suppose the person enter in textbox sy and the listbox displays the result all getting started with sy :
Somewhat like this...,
System
SystemDefault
SystemFolder
so for the all above 3 results Sy must be highlighted.
How to achieve this? tx in advance
First: A TextBlock can be composed of a series of
Inlineitems that each can have different font characteristics. Try looking at the results of this:-Second: You can bind a
ListBoxto anObservableCollection<TextBlock>as long as you only bind it once.Third: You can manipulate the contents of the set of
Inlinesof a textblock in code.Putting it all together:-
Xaml:-
Code:-
Slap this into a new project and have a play. Should work SL3 and 4.