How to load Google Maps in wpf window?

2019-02-07 11:06发布

Is it possible to load Google Maps in wpf window? If yes how can i do this? I'm using visual studio-2010 and DevExpress tool. This code i found from DevExpress official site for openstreetmaps.

const string roadUrlTemplate = @"http://{subdomain}.tile.openstreetmap.org/{tileLevel}/{tileX}/{tileY}.png";

3条回答
The star\"
3楼-- · 2019-02-07 11:26

If you are not limited to using Google Maps then take a look at the Bing Maps WPF control for a truly native WPF map solution:

http://msdn.microsoft.com/en-us/library/hh750210.aspx

If you need to use Google Maps you can of course use a web browser control and create an interlop to communicate between C# and JavaScript however if you want a native WPF solution then take a look at some open source solutions like the following:

http://greatmaps.codeplex.com/

https://github.com/ericnewton76/gmaps-api-net

查看更多
萌系小妹纸
4楼-- · 2019-02-07 11:39

Yes, you can do it by using GDS Google Map WinForms Control. Here it how:

  1. Create a WPF application and make the following XAML: enter image description here

  2. Add a reference to GdsGoogleMap.dll;

  3. Code the followings:

 

namespace MapWpfApp

{

    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow
    {
        private readonly GdsGoogleMap.GdsGoogleMap _gdsGoogleMap;

        public MainWindow()
        {
            InitializeComponent();
            _gdsGoogleMap = new GdsGoogleMap.GdsGoogleMap();
            WindowsFormsHost.Child = _gdsGoogleMap;
        }
    }
}
  1. Compile and run the program and you will see the Google Map on WPF window. enter image description here
查看更多
登录 后发表回答