Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am having one application. In this we are raising tooltip when mouse pointer comes on Image or Label and shows information.
I am using code as
C#
ctrlName.Dispatcher.Invoke(new Action(delegate
{
   ToolTipService.SetToolTip(ctrlName, szToolTipMsg);
}));

This code is crashing app when called.
Can someone point out why this is happening.
Infact, this code was working earlier.

What I have tried:

After lots of trial I replaced above code with following and it start working...
C#
ctrlName.Dispatcher.Invoke(new Action(delegate
{
    ToolTip tt = new ToolTip();
    tt.Content = szToolTipMsg;
    ctrlName.ToolTip = tt;
}));

I want to know what is the reason for this is working. While the ToolTipService.SetToolTip call is working in some other application.
Posted
Updated 5-Jul-22 21:33pm
v2

1 solution

That's not the normal way of doing tooltips... Please refer to this article: Control ToolTips - The complete WPF tutorial[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900