ToolTip in PropertyGrid
How do I add a tooltip to a property in a property grid
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
sumanPosted Feb 12, 2007, 10:42 PM
Thank You very much. Your suggestion was helpful.
Scott LyslePosted Jan 30, 2007, 11:30 PM
Normally you don't add one. The property grid will display a description attribute when the property under edit has been selected and if the description attribute has been set for the defined property. Here is a VB example but the same thing is done in C# (You did not specify a language).
With this example, if the user editing an object with this property, when 'CuName' is selected in the grid, the Description Attribute text will appear in the description area at the bottom of the property grid (sort of like a tooltip). You can create a tooltip and assign display text to it using the SetTooltip method of the tooltip; this accepts a valid Control and the text to be displayed as arguments but this does appear to work for the property grid; I would imagine that is due to the fact that the property grid uses tooltips internally to display the property information for cells in the grid that are too small to display the full text.
Browsable(True), _
BindableAttribute(False), _
DescriptionAttribute("The display name of this CU object.")> _
Public Property CuName() As String
Get
Return mCuName
End Get
Set(ByVal value As String)
mCuName = value
End Set
End Property