Click here to Skip to main content
15,892,575 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I need to Highlight only the Portion of that whole string for example:if user enters Prop in textbox the highlighted output will be
in String "Dependency property" word we need to highlight only "Prop".Please let me know the Solution.
Posted
Updated 2-May-11 2:08am
v2
Comments
Sergey Alexandrovich Kryukov 2-May-11 12:54pm    
TextBox or ListBox?!!
--SA
Sergey Alexandrovich Kryukov 2-May-11 12:57pm    
Tag it! WPF?
--SA

You can't apply different text styles to a TextBox, you should consider using a RichTextBox instead.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 2-May-11 12:57pm    
Let's assume this is TextBox. OP mentioned both ListBox and TextBox, but you have the Presumption of Innocence :-). My 5.
--SA
Olivier Levrey 3-May-11 3:42am    
Oh yes, I missed the listbox part!
Sergey Alexandrovich Kryukov 4-May-11 1:59am    
I think this is no more than a contradiction between title and body of the question. OP probably meant just one thing.
--SA
Sergey Alexandrovich Kryukov 4-May-11 2:05am    
Actually, I just added a very general note on ListBox as my answer.
--SA
You don't answer my question: TextBox or ListBox.

I think this is no a contradiction between title and body of the question. You probably meant just one thing. While I think the answer by Olivier on TextBox/RichTextBox is good enough, the text rendering you need is not so easy to achieve for ListBox. You can create your own control (probably derived from ListBox) and custom-paint it.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900