ToolTip.CustomPopupPlacementCallback 属性

定义

获取或设置用于放置此 ToolTip 的委托处理程序方法。

public:
 property System::Windows::Controls::Primitives::CustomPopupPlacementCallback ^ CustomPopupPlacementCallback { System::Windows::Controls::Primitives::CustomPopupPlacementCallback ^ get(); void set(System::Windows::Controls::Primitives::CustomPopupPlacementCallback ^ value); };
[System.ComponentModel.Bindable(false)]
public System.Windows.Controls.Primitives.CustomPopupPlacementCallback CustomPopupPlacementCallback { get; set; }
[<System.ComponentModel.Bindable(false)>]
member this.CustomPopupPlacementCallback : System.Windows.Controls.Primitives.CustomPopupPlacementCallback with get, set
Public Property CustomPopupPlacementCallback As CustomPopupPlacementCallback

属性值

提供 ToolTip 的放置信息的 CustomPopupPlacementCallback 委托方法。 默认值为 null

属性

示例

以下示例演示如何设置 CustomPopupPlacementCallback 属性并创建相应的委托。 相同的技术由 Popup使用,如 Popup 放置示例中所示。

aToolTip.Placement = PlacementMode.Custom;
aToolTip.CustomPopupPlacementCallback =
    new CustomPopupPlacementCallback(placeToolTip);
aToolTip.Placement = PlacementMode.Custom
aToolTip.CustomPopupPlacementCallback = New CustomPopupPlacementCallback(AddressOf placeToolTip)
public CustomPopupPlacement[] placeToolTip(Size popupSize,
                                           Size targetSize,
                                           Point offset)
{
    CustomPopupPlacement placement1 =
       new CustomPopupPlacement(new Point(-50, 100), PopupPrimaryAxis.Vertical);

    CustomPopupPlacement placement2 =
        new CustomPopupPlacement(new Point(10, 20), PopupPrimaryAxis.Horizontal);

    CustomPopupPlacement[] ttplaces =
            new CustomPopupPlacement[] { placement1, placement2 };
    return ttplaces;
}
Public Function placeToolTip(ByVal popupSize As Size, ByVal targetSize As Size, ByVal offset As Point) As CustomPopupPlacement()
    Dim placement1 As New CustomPopupPlacement(New Point(-50, 100), PopupPrimaryAxis.Vertical)

    Dim placement2 As New CustomPopupPlacement(New Point(10, 20), PopupPrimaryAxis.Horizontal)

    Dim ttplaces() As CustomPopupPlacement = { placement1, placement2 }
    Return ttplaces
End Function

注解

属性 Placement 必须设置为 Custom 才能使用回调委托。

委托 CustomPopupPlacementCallback 返回一个数组,其中包含针对 PlacementTarget定义的可能点。 ToolTip显示 时,会选择一个点,该点将最大化可见窗口ToolTip的量。

依赖项属性信息

标识符字段 CustomPopupPlacementCallbackProperty
元数据属性设置为 true

适用于

另请参阅