Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Text Editor - Text bold problem
4 replies. Latest Post by nz on November 4, 2009.
(0)
nz
Member
9 points
14 Posts
11-04-2009 6:42 AM |
I got a problem with set a selected word into bold form in a textbox based on silverlight 3, can any one tell me how to control it in c# code,
many thx
11-04-2009 6:48 AM |
Maybe I didn't make this clear enough, I mean I want set a selected text into bold in a textbox
rabbott
268 points
37 Posts
11-04-2009 6:50 AM |
Hi nz,
You can't change the appearance of an individual word in a TextBox in Silverlight. (You can in a TextBlock by specifying Run elements as below, but of course a TextBlock isn't user-editable.)
<TextBlock> <Run FontWeight="Bold">This text will be bold, </Run> <Run Foreground="Red">and this will be red.</Run> </TextBlock>
Silverlight doesn't have a RichTextBox like WPF does (although I believe some third-party Silverlight RichTextBox controls are available), which would be capable of doing what you're after.
Regards,Rob
Pravinku...
Contributor
4300 points
708 Posts
11-04-2009 7:03 AM |
Hi,
Just a thought. Why don't you think about using RichTextBox here? Check this out - http://www.codeplex.com/richtextedit
Thanks,
Pravin
"Please mark as answered, if this answers your question"
11-04-2009 12:59 PM |
Thank you for you help, Now I got another question, How can I get those run elements? because I try to do copy of two textblocks, I want their text be the same, and also font ....
sorry If it is not clear enough.