开发者

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 app开发者_运维技巧ear when I want in this case?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜