views:

2039

answers:

1

Hello,

I have a TextBox and ListBox. User can search ListBox elements from TextBox.

ListBox is bound to CollectionViewSource.

CollectionViewSource has Filter event handler, that filters elements based on text that user enters into TextBox.

My requirement is to highlight user entered text within TextBlock of ListBoxItem elements.

I was thinking of breaking TextBlock into several Runs objects and modify Background property of Run objects that need to be highlighted.

I think it is not possible to do with DataTemplates.

Is there easy way to accomplish this?

Thank You!

+7  A: 
Kent Boogaart
OK, I have my ViewModel. I'll try to start with Your idea. I will keep you updated with my progress. Thank You.
Daniil Harik
Wow. It will be pleasure to dig into the code. Thank You very much...I will let you know
Daniil Harik
Very nice solution I've been looking for. Thanks.
Dusan Kocurek