PlaceInfo 類別

定義

顯示地圖位置和資訊,描述當使用者在視窗外部按一下時自動關閉的光線解除允許視窗中的位置。

public ref class PlaceInfo sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 327680)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class PlaceInfo final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 327680)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class PlaceInfo
Public NotInheritable Class PlaceInfo
繼承
Object Platform::Object IInspectable PlaceInfo
屬性

Windows 需求

裝置系列
Windows 10 Fall Creators Update (已於 10.0.16299.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v5.0 引進)

範例

此範例顯示使用者按一下該位置的按鈕下方的西雅圖太空針點位置。

private void SpaceNeedle_Click(object sender, RoutedEventArgs e)
{
    Geopoint spaceNeedlePoint = new Geopoint
        (new BasicGeoposition { Latitude = 47.6205, Longitude = -122.3493 });

    PlaceInfoCreateOptions options = new PlaceInfoCreateOptions();

    options.DisplayAddress = "400 Broad St, Seattle, WA 98109";
    options.DisplayName = "Seattle Space Needle";

    PlaceInfo spaceNeedlePlace =  PlaceInfo.Create(spaceNeedlePoint, options);

    FrameworkElement targetElement = (FrameworkElement)sender;

    GeneralTransform generalTransform =
        targetElement.TransformToVisual((FrameworkElement)targetElement.Parent);

    Rect rectangle = generalTransform.TransformBounds(new Rect(new Point
        (targetElement.Margin.Left, targetElement.Margin.Top), targetElement.RenderSize));

    spaceNeedlePlace.Show(rectangle, Windows.UI.Popups.Placement.Below);
}

備註

版本歷程記錄

Windows 版本 SDK 版本 已新增值
1803 17134 CreateFromAddress (String)
1803 17134 CreateFromAddress (String,String)

屬性

DisplayAddress

取得 與 PlaceInfo相關聯的位址。

DisplayName

取得與 PlaceInfo相關聯的顯示名稱。

Geoshape

取得與 PlaceInfo相關聯的地理圖形。

Identifier

取得 與 PlaceInfo相關聯的識別碼。

IsShowSupported

取得值,這個值表示您的應用程式是否可以顯示光線解除的視窗,其中包含目前內容中的地圖位置和相關資訊。

方法

Create(Geopoint)

建立 PlaceInfo 實例。

Create(Geopoint, PlaceInfoCreateOptions)

建立 PlaceInfo 實例。

CreateFromAddress(String)

使用位址建立 PlaceInfo 實例。

CreateFromAddress(String, String)

使用位址和顯示名稱建立 PlaceInfo 實例。

CreateFromIdentifier(String)

建立 PlaceInfo 實例。

CreateFromIdentifier(String, Geopoint, PlaceInfoCreateOptions)

建立 PlaceInfo 實例。

CreateFromMapLocation(MapLocation)

建立 PlaceInfo 實例。

Show(Rect)

顯示在快顯視窗中,即 PlaceInfo中所述的地圖位置和相關資訊。

Show(Rect, Placement)

顯示在淺色可解除的視窗中,地圖位置和 PlaceInfo中所述的相關資訊。

適用於