I need to show tooltips on the elements of a RadForm TitleBar, like in the attached image.
things I've tried that didn't work:
- setting the ToolTipText
this
.FormElement.TitleBar.SystemButtons.Children[0].ToolTipText =
"this is a tooltip"
;
- using the ToolTipTextNeeded form event
class
TestTooltipForm : RadForm
{
public
TestTooltipForm()
{
InitializeComponent();
this
.ToolTipTextNeeded += (sender, args) =>
{
args.ToolTipText =
"a tooltip"
;
};
}
}
The only thing that seems to be working is instantiating a RadToolTip and showing it inside del ToolTipTextNeeded (ignoring the args parameter)
The problem with this method is that the tooltip stays visible forever, so I need to hide it on some event like 'form_mouseHover' which is kind of convoluted.
Is there a better way?
6 Answers, 1 is accepted
You need to set the AutoToolTip property as well:
this
.FormElement.TitleBar.SystemButtons.Children[1].ToolTipText =
"Test1"
;
this
.FormElement.TitleBar.SystemButtons.Children[1].AutoToolTip =
true
;
this
.FormElement.TitleBar.SystemButtons.Children[2].ToolTipText =
"Test2"
;
this
.FormElement.TitleBar.SystemButtons.Children[2].AutoToolTip =
true
;
this
.FormElement.TitleBar.SystemButtons.Children[3].ToolTipText =
"Test3"
;
this
.FormElement.TitleBar.SystemButtons.Children[3].AutoToolTip =
true
;
In addition, the first child is the help button which is not visible by default.
Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik
setting AutoToolTip does not solve. No tooltip appears
btw: here SystemButtons.Children has only 3 items and Children[0] is the minimize button, not the hidden 'help button'
This works as expected on my side. Which version of the suite are you using?
I am looking forward to your reply.
Regards,
Dimitar
Progress Telerik
You are right. I'm having the issue on a very old 2014.3.1202.40
I've just tried on 2015.2.728.40 and it works.
Last question. In your example, how do I configure the tooltip aspect? Things like icon
The tooltip can be accessed in the from's ToolTipTextNeeded event handler. Here is an example:
private
void
RadForm1_ToolTipTextNeeded(
object
sender, Telerik.WinControls.ToolTipTextNeededEventArgs e)
{
var item = sender
as
RadImageButtonElement;
if
(item !=
null
&& item ==
this
.FormElement.TitleBar.SystemButtons.Children[1])
{
e.ToolTip.ToolTipIcon = ToolTipIcon.Warning;
e.ToolTipText =
"Test"
;
}
}
If you want more complex layout in the tooltip to consider using Screen Tips | Telerik Presentation Framework.
I hope this will be useful.
Regards,
Dimitar
Progress Telerik
Works perfectly
thanks