Share via


IXRToolTip (Windows Embedded CE 6.0)

1/6/2010

This class represents a control that creates a small pop-up window that displays information for an element in the UI.

Syntax

class IXRToolTip : public IXRContentControl

Methods

Method Description

IXRToolTip::AddClosedEventHandler

Attaches a delegate to the Closed event handler for this tooltip. When the tooltip raises the Closed event, this delegate will be invoked.

IXRToolTip::AddOpenedEventHandler

Attaches a delegate to the Opened event for this tooltip. When the tooltip raises the Opened event, this delegate will be invoked.

IXRToolTip::GetHorizontalOffset

Retrieves the horizontal distance between the target origin and the pop-up alignment point.

IXRToolTip::GetIsOpen

Retrieves a value that indicates whether this tooltip is visible.

IXRToolTip::GetVerticalOffset

Retrieves the vertical distance between the target origin and the pop-up alignment point.

IXRToolTip::RemoveOpenedEventHandler

Removes a delegate from the Opened event for this tooltip.

IXRToolTip::RemoveClosedEventHandler

Removes a delegate from the Closed event for this tooltip.

IXRToolTip::SetHorizontalOffset

Sets the horizontal distance between the target origin and the pop-up alignment point.

IXRToolTip::SetIsOpen

Sets a value that indicates whether this tooltip is visible.

IXRToolTip::SetVerticalOffset

Sets the vertical distance between the target origin and the pop-up alignment point.

Remarks

You use a tooltip control to provide information to the user. For example, you can use a tooltip to provide a label for an IXRButton control. A tooltip displays the content specified in the inherited method IXRContentControl::SetContent. Its content can vary from a simple text string to more complex content, such as an IXRImage object or an IXRStackPanel object with embedded text and images. The content of a tooltip cannot receive the focus.

You can define the position and behavior of the tooltip by using the methods of the IXRToolTip class. To add a tooltip to a control, set its ToolTipService.ToolTip attached property by calling IXRDependencyObject::SetAttachedProperty(const WCHAR*, IXRDependencyObject*).

You can provide tips in the content of a tooltip to help users understand unknown or unfamiliar objects that are not described directly in the user interface.

You can also define a tooltip in Microsoft Silverlight 2 XAML. For information about the differences between XAML in Silverlight for Windows Embedded and Silverlight 2, see Differences Between Silverlight for the Web and Silverlight for Windows Embedded. For more information about how to define this element in the source XAML for your application, see this Microsoft Web site.

Example

The following example code creates a tooltip for a control that displays the text specified in the pText input parameter.

#include <windows.h>
#include <XamlRuntime.h>
#include <XRPtr.h>


void AddToolTip(IXRControl* pControl, WCHAR* pText)
{
IXRToolTipPtr pToolTip;
float hzOffset = 10;
float vtOffset = 20;

XRValue xrValue;
xrValue.vType = VTYPE_READONLY_STRING;
xrValue.pReadOnlyStringVal = pText;

pToolTip->SetHorizontalOffset(hzOffset);
pToolTip->SetVerticalOffset(vtOffset);
pToolTip->SetContent(&xrValue);

pControl->SetAttachedProperty(L"ToolTipService.ToolTip", pToolTip);

}

To run this sample code, you must already have a control derived from IXRControl that you want to create a tooltip for. This control should already exist in the visual tree.

Inheritance Hierarchy

IXRDependencyObject

    IXRUIElement

        IXRFrameworkElement

            IXRControl

                IXRContentControl

                    IXRToolTip

.NET Framework Equivalent

System.Windows.Controls.ToolTip

Requirements

Header XamlRuntime.h
sysgen SYSGEN_XAML_RUNTIME
Windows Embedded CE Windows Embedded CE 6.0 R3

See Also

Reference

Classes for UI Element Management

Other Resources