Miklós Balogh
Miklós Balogh

Reputation: 2202

Show Tooltip immediately after click

I've got a Tree with custom TreeViewItems. The TreeViewItems contains a CheckBox. When I click on a CheckBox the background logic decides whether the click was valid or not and if it was invalid a warning message should be shown.

I added a Tooltip to each TreeViewItem and set the visibility to Collapsed when doing declaration. The Tooltip should show the message but if I set it to Visible in the TvItems click event it doesn't appears immediately just after it gets the mouseOver event again. Its the same if I set the IsOpen property in the event.

How can I force the Tooltip to appear when I want in this case?

Upvotes: 0

Views: 1624

Answers (1)

dowhilefor
dowhilefor

Reputation: 11051

You can try to use the ToolTipService class to set the InitialShowDelay to 0. But i think this will also show the tooltip directly when you hover your mouse over the element.

Maybe you should reconsider this design, because i think what you want to do proves to be difficult in some circumstances or not usable.

If you want to do it on a mouse Click, i would use a attached behavior to hook the mouse click, and show the tooltip by hand, which can be accomplished by grabbing the ToolTip of your TreeViewItem and setting IsOpen to true.

Upvotes: 1

Related Questions