Updating a tooltip in Silverlight 2
-
07-07-2019 - |
Question
I have a control in Silverlight 2 that changes state during the application. When its state changes, I want to update the tooltip that goes with it.
I'm using the ToolTipService:
ToolTipService.SetToolTip(ent.LayoutRoot, "FooBar");
which works fine the first time I set a tooltip, but fails the second time time around I get:
"Object reference not set to an instance of an object"
from somewhere inside Silverlight where I can't get a useful stack trace / break point.
Trawling the net pops up a few similar problems but no solutions.
Can anyone shed some light on this?
Solution
Found the problem - it looks like you can't set a ToolTip after the control is created. So now, I set the ToolTip in the controls constructor, then when it needs updating, the call to SetToolTop() works just fine.