radioman / greatmaps

GMap.NET - Great Maps for Windows Forms & Presentation
916 stars 410 forks source link

GMap.NET MVVM #60

Open Niko0pl opened 7 years ago

Niko0pl commented 7 years ago

I would like to add an GMap.NET control to my WPF MVVM application. However I am new in MVVM and I do not know how to manage (add markers, changing map provider) my control without reference to its name from View. For now on I'm doing it like that: gmap.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance; GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly; gmap.DragButton = MouseButton.Left; gmap.SetPositionByKeywords("Paris, France"); gmap.ShowCenter = false; but how to adjust it to MVVM? I will be grateful for solutions, links, references, etc...

[EDIT] For now on I've came up with an idea to create all GMap.NET control in ViewModel and bind whole control like: <UserControl Content="{Binding GMapC}"/>