View previous topic :: View next topic |
Author |
Message |
Happs
Joined: 13 Jul 2011 Posts: 62 Location: Sydney, Australia
|
Posted: Wed Sep 21, 2011 3:51 am Post subject: Bold multiple words in cell data & tooltip |
|
|
I am using object binding, also overriding GetCellData method to update cell value for a specific column. Its working fine.
I would like to format ToolTip and cell value so some of matching words get highlighted.
For example:
"No matter how many goals you have achieved, you must set your sights on a higher one. "
I would like to bold "goals" & "sights" in above text, and these keywords can be change.
I had a look at your RichTextTree example, CellData.Format & CellData.Value property, but not sure how to use Value property to format multiple words.
Thanks. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Wed Sep 21, 2011 10:32 am Post subject: |
|
|
The standard .NET tooltips used by Virtual Tree don't support RichText - or any other way of bolding a single word in the text.
To bold individual words in cells you need to set the CellData.IsRichTextFormat property to true and then format the CellData.Value as RTF. For instance your text as an RTF string would be:
Code: |
e.CellData.IsRichTextFormat = true;
e.CellData.Value = @"{\rtf1\ansi No matter how many \b goals \b0 you have achieved, you must set your \b sights \b0 on a higher one}\par"; |
You can alternatively set the CellData.Format and include a place holder {0} for the cell value to be inserted (as shown in the RichTextTree sample).
To display tooltips you should set e.CellData.ToolTip explicitly and also set AlwaysDisplayToolTip to true (otherwise tooltips won't be displayed for RichText content) eg
Code: | e.CellData.ToolTip = "No matter how many goals you have achieved, you must set your sights on a higher one";
e.CellData.AlwaysDisplayToolTip = true; |
_________________ Infralution Support |
|
Back to top |
|
|
|