GeoMap控件非常易于自定义,这 是世界各地的地图的集合,您也可以创建自己的地图。
GeoMap是Alpha版本,它们应该具有更多功能,并根据您的想法在github存储库中创建新版本。
![在这里插入图片描述](https://img-blog.csdnimg.cn/20200414223734927.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQzMzA3OTM0,size_16,color_FFFFFF,t_70)
后台
using System;
using System.Collections.Generic;
using System.Windows.Controls;
namespace Wpf.Maps
{
public partial class GeoMapExample : UserControl
{
public GeoMapExample()
{
InitializeComponent();
var r = new Random();
Values = new Dictionary<string, double>();
Values["MX"] = r.Next(0, 100);
Values["CA"] = r.Next(0, 100);
Values["US"] = r.Next(0, 100);
Values["IN"] = r.Next(0, 100);
Values["CN"] = r.Next(0, 100);
Values["JP"] = r.Next(0, 100);
Values["BR"] = r.Next(0, 100);
Values["DE"] = r.Next(0, 100);
Values["FR"] = r.Next(0, 100);
Values["GB"] = r.Next(0, 100);
LanguagePack = new Dictionary<string, string>();
LanguagePack["MX"] = "México";
DataContext = this;
}
public Dictionary<string, double> Values { get; set; }
public Dictionary<string, string> LanguagePack { get; set; }
}
}
前台
<UserControl x:Class="Wpf.Maps.GeoMapExample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Wpf.Maps"
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
d:DataContext="{d:DesignInstance local:GeoMapExample}">
<Grid>
<lvc:GeoMap HeatMap="{Binding Values}" Source="Maps/World.xml" LanguagePack="{Binding LanguagePack}" />
</Grid>
</UserControl>