What are the main differences between these WPF controls?
And when I should use a ToolTip
instead of Popup
?
问题:
回答1:
A ToolTip
is a small pop-up window that appears when a user pauses the mouse pointer over an element; the Popup
control provides a way to display content in a separate window that floats over the current application window relative to a designated element or screen coordinate.
A Popup
does not automatically open when the mouse pointer moves over its parent object. If you want a Popup
to automatically open, use the ToolTip
or ToolTipService
class.
For more information see: ToolTip overview and Popup overview.
回答2:
Previous tooltips in Winforms were overly restrictive in what you could display. This is why people rolled their own. WPF tooltips allow you to apply a templatize view with color, images, formatting, you name it. The days of rolling your own in that are mostly gone; mostly.