Files
@ 65c134a3d619
Branch filter:
Location: seniordesign-ui/Testing/TemplatedBinding/Window1.xaml.cs
65c134a3d619
2.7 KiB
text/x-csharp
Initial import of mapping source (huge commit)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows;
using GMap.NET.WindowsPresentation;
using GMap.NET.MapProviders;
namespace TemplatedBinding
{
class MapArr : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
void OnPropertyChanged(string name)
{
if(PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(name));
}
}
GMapControl map;
public GMapControl Map
{
get
{
return map;
}
set
{
map = value;
OnPropertyChanged("Map");
}
}
string location;
public string Location
{
get
{
return location;
}
set
{
location = value;
OnPropertyChanged("Location");
}
}
public MapArr(GMapControl m, string location)
{
Map = m;
Location = location;
Map.SetCurrentPositionByKeywords(Location);
}
}
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
ObservableCollection<MapArr> mapCtrl = new ObservableCollection<MapArr>();
// 1
{
GMapControl map = new GMapControl();
map.MapProvider = GMapProviders.OpenStreetMap;
map.MinZoom = 4;
map.MaxZoom = map.MinZoom + 3;
map.Zoom = map.MinZoom;
mapCtrl.Add(new MapArr(map, "Holand"));
}
// 2
{
GMapControl map = new GMapControl();
map.MapProvider = GMapProviders.OpenStreetMap;
map.MinZoom = 4;
map.MaxZoom = map.MinZoom + 3;
map.Zoom = map.MinZoom;
mapCtrl.Add(new MapArr(map, "New York"));
}
// 3
{
GMapControl map = new GMapControl();
map.MapProvider = GMapProviders.OpenStreetMap;
map.MinZoom = 4;
map.MaxZoom = map.MinZoom + 3;
map.Zoom = map.MinZoom;
mapCtrl.Add(new MapArr(map, "Lithuania"));
}
// main
UserMap.MapProvider = GMapProviders.GoogleMap;
UserMap.MinZoom = 5;
UserMap.MaxZoom = 13;
UserMap.Zoom = 5;
UserMap.SetCurrentPositionByKeywords("Leuven");
// add all maps
locations.ItemsSource = mapCtrl;
}
}
}
|