Bing Map for WPF

      在〈Bing Map for WPF〉中尚無留言

Bing map

Bing map是微軟開發的地圖, 可以簡易的崁入wpf裏. 以前都說只有英文的地址. 但經測試, 現在的台灣地圖都是中文地址了.

套件

首先需由Nuget庫新增三個sdk:MaterialDesignThemes, MaterialDesignColors及Microsoft.Maps.MapControl.WPF

App.xaml

打開App.xaml新增 <ResourceDictionary>

此段為改變整個畫面的Theme, 所以可以不用改. 

<Application x:Class="BingMapTest.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:BingMapTest"
    StartupUri="MainWindow.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Blue.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.LightBlue.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

xaml設定

請依如下在 Grid填入元件, 其中的 CredentialsProvider 必需填入一組key.

此key請到微軟網站 https://www.bingmapsportal.com/Application , 註冊登入後, 再由my account/my key 申請一組key, 再將之填入

🔒 底下內容僅限會員閱讀。

立即登入

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *