Prev | Current Page 377 | Next

Matthew MacDonald

"Pro WPF with VB 2008: Windows Presentation Foundation with .NET 3.5"

ToolTip>
I have a fancy tooltip

As in the previous example, WPF implicitly creates a ToolTip object. The difference is that
in this case the ToolTip object contains a StackPanel rather than a simple string. Figure 7-3
shows the result.
Figure 7-3. A fancy tooltip
CHAPTER 7 n CLASSIC CONTROLS 199
If more than one tooltip overlaps, the most specific tooltip wins. For example, if you add a
tooltip to the StackPanel container in the previous example, this tooltip appears when you
hover over an empty part of the panel or a control that doesn??™t have its own tooltip.
nNote Don??™t put user-interactive controls in a tooltip because the ToolTip window can??™t accept focus. For
example, if you place a button in a ToolTip, the button will appear, but it isn??™t clickable. (If you attempt to click
it, your mouse click will just pass through to the window underneath.) If you want a tooltip-like window that
can hold other controls, consider using the Popup instead, which is discussed shortly, in the section named
???The Popup.???
Setting ToolTip Properties
The previous example shows how you can customize the content of a tooltip, but what if you
want to configure other ToolTip-related settings? You actually have two options. The first technique
you can use is to explicitly define the ToolTip object.


Pages:
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389