I think I have a not so complicated problem, but I can't solve it or find the solution on internet.
I have some random RichTextBox
<RichTextBox x:Name="myRichTextBox" ToolTipOpening="RichTextBoxEx1_ToolTipOpening" ToolTip=" "></RichTextBox>
I want to show a specific Tooltip depending on the word hovered by the mouse. I already have a solution for this.
Let's said that my RichTextBox have a text like this "My house is green". If I hover over the word 'green', it shows the Tooltip OK, but if I need to show the Tooltip over the word 'house' I need to get out my mouse of the RichTextBox control and enter again.
So, I'm asking for some 'reset' of the tooltip. Something like, when I move my mouse, the current Tooltip disappears and I dont need to wait for a new Tooltip without take out my mouse of the control.
Thank you so much.
I usually just set ToolTip
property to null
and assign a new ToolTip
object:
element.ToolTip = null;
var tooltip = new ToolTip();
tooltip.Content = ...
element.ToolTip = tooltip;
tooltip.IsOpen = true;
tooltip.StaysOpen = false;
Now to call this code, you will have to implement some kind of hover mechanism based on MouseMove
event and preferably a timer - it's not included in WPF.