Loading...
Loading...
Compare original and translation side by side
<Window xmlns:syncfusion="clr-namespace:Syncfusion.UI.Xaml.Maps;assembly=Syncfusion.SfMaps.WPF">
<Grid>
<Grid.DataContext>
<local:MapViewModel />
</Grid.DataContext>
<syncfusion:SfMap>
<syncfusion:SfMap.Layers>
<syncfusion:ShapeFileLayer Uri="MyApp.ShapeFiles.world1.shp"
ItemsSource="{Binding Countries}"
ShapeIDPath="Name"
ShapeIDTableField="NAME"
EnableSelection="True">
<syncfusion:ShapeFileLayer.ShapeSettings>
<syncfusion:ShapeSetting ShapeValuePath="Population"
ShapeStroke="White"
ShapeStrokeThickness="1">
<syncfusion:ShapeSetting.FillSetting>
<syncfusion:ShapeFillSetting AutoFillColors="False">
<syncfusion:ShapeFillSetting.ColorMappings>
<syncfusion:RangeColorMapping From="0" To="1000000" Color="#FEE5D9" />
<syncfusion:RangeColorMapping From="1000000" To="10000000" Color="#FCAE91" />
<syncfusion:RangeColorMapping From="10000000" To="100000000" Color="#FB6A4A" />
<syncfusion:RangeColorMapping From="100000000" To="1000000000" Color="#CB181D" />
</syncfusion:ShapeFillSetting.ColorMappings>
</syncfusion:ShapeFillSetting>
</syncfusion:ShapeSetting.FillSetting>
</syncfusion:ShapeSetting>
</syncfusion:ShapeFileLayer.ShapeSettings>
</syncfusion:ShapeFileLayer>
</syncfusion:SfMap.Layers>
</syncfusion:SfMap>
</Grid>
</Window><Window xmlns:syncfusion="clr-namespace:Syncfusion.UI.Xaml.Maps;assembly=Syncfusion.SfMaps.WPF">
<Grid>
<Grid.DataContext>
<local:MapViewModel />
</Grid.DataContext>
<syncfusion:SfMap>
<syncfusion:SfMap.Layers>
<syncfusion:ShapeFileLayer Uri="MyApp.ShapeFiles.world1.shp"
ItemsSource="{Binding Countries}"
ShapeIDPath="Name"
ShapeIDTableField="NAME"
EnableSelection="True">
<syncfusion:ShapeFileLayer.ShapeSettings>
<syncfusion:ShapeSetting ShapeValuePath="Population"
ShapeStroke="White"
ShapeStrokeThickness="1">
<syncfusion:ShapeSetting.FillSetting>
<syncfusion:ShapeFillSetting AutoFillColors="False">
<syncfusion:ShapeFillSetting.ColorMappings>
<syncfusion:RangeColorMapping From="0" To="1000000" Color="#FEE5D9" />
<syncfusion:RangeColorMapping From="1000000" To="10000000" Color="#FCAE91" />
<syncfusion:RangeColorMapping From="10000000" To="100000000" Color="#FB6A4A" />
<syncfusion:RangeColorMapping From="100000000" To="1000000000" Color="#CB181D" />
</syncfusion:ShapeFillSetting.ColorMappings>
</syncfusion:ShapeFillSetting>
</syncfusion:ShapeSetting.FillSetting>
</syncfusion:ShapeSetting>
</syncfusion:ShapeFileLayer.ShapeSettings>
</syncfusion:ShapeFileLayer>
</syncfusion:SfMap.Layers>
</syncfusion:SfMap>
</Grid>
</Window>using System.Collections.ObjectModel;
using System.ComponentModel;
public class Country : INotifyPropertyChanged
{
private string name;
private int population;
public string Name
{
get { return name; }
set { name = value; OnPropertyChanged(nameof(Name)); }
}
public int Population
{
get { return population; }
set { population = value; OnPropertyChanged(nameof(Population)); }
}
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
public class MapViewModel
{
public ObservableCollection<Country> Countries { get; set; }
public MapViewModel()
{
Countries = new ObservableCollection<Country>
{
new Country { Name = "United States", Population = 331000000 },
new Country { Name = "China", Population = 1400000000 },
new Country { Name = "India", Population = 1380000000 },
new Country { Name = "Brazil", Population = 212000000 }
};
}
}using System.Collections.ObjectModel;
using System.ComponentModel;
public class Country : INotifyPropertyChanged
{
private string name;
private int population;
public string Name
{
get { return name; }
set { name = value; OnPropertyChanged(nameof(Name)); }
}
public int Population
{
get { return population; }
set { population = value; OnPropertyChanged(nameof(Population)); }
}
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
public class MapViewModel
{
public ObservableCollection<Country> Countries { get; set; }
public MapViewModel()
{
Countries = new ObservableCollection<Country>
{
new Country { Name = "United States", Population = 331000000 },
new Country { Name = "China", Population = 1400000000 },
new Country { Name = "India", Population = 1380000000 },
new Country { Name = "Brazil", Population = 212000000 }
};
}
}<syncfusion:ShapeFileLayer Uri="MyApp.ShapeFiles.usa_state.shp"
Markers="{Binding Cities}">
<syncfusion:ShapeFileLayer.MarkerTemplate>
<DataTemplate>
<Grid>
<Ellipse Width="12" Height="12" Fill="Red" />
<TextBlock Text="{Binding Label}"
Margin="0,15,0,0"
FontSize="11"
Foreground="Black" />
</Grid>
</DataTemplate>
</syncfusion:ShapeFileLayer.MarkerTemplate>
</syncfusion:ShapeFileLayer>public class City
{
public string Label { get; set; }
public string Latitude { get; set; }
public string Longitude { get; set; }
}<syncfusion:ShapeFileLayer Uri="MyApp.ShapeFiles.usa_state.shp"
Markers="{Binding Cities}">
<syncfusion:ShapeFileLayer.MarkerTemplate>
<DataTemplate>
<Grid>
<Ellipse Width="12" Height="12" Fill="Red" />
<TextBlock Text="{Binding Label}"
Margin="0,15,0,0"
FontSize="11"
Foreground="Black" />
</Grid>
</DataTemplate>
</syncfusion:ShapeFileLayer.MarkerTemplate>
</syncfusion:ShapeFileLayer>public class City
{
public string Label { get; set; }
public string Latitude { get; set; }
public string Longitude { get; set; }
}<syncfusion:ShapeFileLayer.ToolTipSettings>
<syncfusion:ToolTipSetting ValuePath="Population" />
</syncfusion:ShapeFileLayer.ToolTipSettings><syncfusion:ShapeFileLayer.ToolTipSettings>
<syncfusion:ToolTipSetting ValuePath="Population" />
</syncfusion:ShapeFileLayer.ToolTipSettings><syncfusion:SfMap EnableZoom="True"
EnablePan="True"
MinZoom="1"
MaxZoom="20"
ZoomLevel="5" /><syncfusion:SfMap EnableZoom="True"
EnablePan="True"
MinZoom="1"
MaxZoom="20"
ZoomLevel="5" /><syncfusion:ShapeFileLayer LegendVisibility="Visible"
LegendPosition="BottomLeft"
LegendHeader="Population Density"
LegendIcon="Rectangle"
LegendColumnSplit="2" /><syncfusion:ShapeFileLayer LegendVisibility="Visible"
LegendPosition="BottomLeft"
LegendHeader="Population Density"
LegendIcon="Rectangle"
LegendColumnSplit="2" />getting-started.mdgetting-started.md