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

屬性值

CustomPopupPlacementCallback 委派方法,提供 ToolTip 的位置資訊。 預設為 null

屬性

範例

下列範例示範如何設定 CustomPopupPlacementCallback 屬性,並建立對應的委派。 相同的技術由 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

適用於

另請參閱