Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Bold multiple words in cell data & tooltip

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
Happs



Joined: 13 Jul 2011
Posts: 62
Location: Sydney, Australia

PostPosted: Wed Sep 21, 2011 3:51 am    Post subject: Bold multiple words in cell data & tooltip Reply with quote

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
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed Sep 21, 2011 10:32 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group