Class MapLayer
Represent the MapLayer in the SfMap. Inherited from the System.Windows.Controls.Control class
Namespace: Syncfusion.UI.Xaml.Maps
Assembly: Syncfusion.SfMaps.WPF.dll
Syntax
public abstract class MapLayer : Control
Remarks
MapLayer is the Base class for all layer class in maps.
Constructors
MapLayer()
Initializes a new instance of the MapLayer class.
Declaration
public MapLayer()
Fields
MarkerHorizontalAlignmentProperty
The DependencyProperty of MarkerHorizontalAlignment property
Declaration
public static readonly DependencyProperty MarkerHorizontalAlignmentProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
MarkerIconFillProperty
The DependencyProperty of MarkerIconFill property
Declaration
public static readonly DependencyProperty MarkerIconFillProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
MarkerIconSizeProperty
The DependencyProperty of MarkerIconSize property
Declaration
public static readonly DependencyProperty MarkerIconSizeProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
MarkerIconSourceProperty
The DependencyProperty of MarkerIconSource property
Declaration
public static readonly DependencyProperty MarkerIconSourceProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
MarkerIconTypeProperty
The DependencyProperty of MarkerIconType property
Declaration
public static readonly DependencyProperty MarkerIconTypeProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
MarkerLabelFontFamilyProperty
The DependencyProperty of MarkerLabelFontFamily property
Declaration
public static readonly DependencyProperty MarkerLabelFontFamilyProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
MarkerLabelFontSizeProperty
The DependencyProperty of MarkerLabelFontSize property
Declaration
public static readonly DependencyProperty MarkerLabelFontSizeProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
MarkerLabelFontStyleProperty
The DependencyProperty of MarkerLabelFontStyle property
Declaration
public static readonly DependencyProperty MarkerLabelFontStyleProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
MarkerLabelFontWeightProperty
Declaration
public static readonly DependencyProperty MarkerLabelFontWeightProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
MarkerLabelForegroundProperty
The DependencyProperty of MarkerLabelForeground property
Declaration
public static readonly DependencyProperty MarkerLabelForegroundProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
MarkerSelectionModeProperty
The DependencyProperty of MarkerSelectionMode property
Declaration
public static readonly DependencyProperty MarkerSelectionModeProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
MarkerTemplateSelectorProperty
Identifies the MarkerTemplateSelector dependency property.
Declaration
public static readonly DependencyProperty MarkerTemplateSelectorProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for MarkerTemplateSelector dependency property. |
MarkerToolTipSettingsProperty
Using a DependencyProperty as the backing store for MarkerToolTipSettings. This enables animation, styling, binding, etc...
Declaration
public static readonly DependencyProperty MarkerToolTipSettingsProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
MarkerVerticalAlignmentProperty
The DependencyProperty of MarkerVerticalAlignment property
Declaration
public static readonly DependencyProperty MarkerVerticalAlignmentProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Properties
MarkerHorizontalAlignment
Gets or sets the value for marker position in HorizontalAlignment
Declaration
public MarkerAlignment MarkerHorizontalAlignment { get; set; }
Property Value
Type |
---|
MarkerAlignment |
MarkerIconFill
Gets or sets the value for marker icon color
Declaration
public Brush MarkerIconFill { get; set; }
Property Value
Type |
---|
System.Windows.Media.Brush |
MarkerIconSize
Gets or sets the value for marker icon size
Declaration
public Size MarkerIconSize { get; set; }
Property Value
Type |
---|
System.Windows.Size |
MarkerIconSource
Gets or set the value for marker icon source
Declaration
public ImageSource MarkerIconSource { get; set; }
Property Value
Type |
---|
System.Windows.Media.ImageSource |
MarkerIconType
Gets or sets the value for marker icon
Declaration
public MarkerIcon MarkerIconType { get; set; }
Property Value
Type |
---|
MarkerIcon |
MarkerLabelFontFamily
Gets or sets the value for marker label font family
Declaration
public FontFamily MarkerLabelFontFamily { get; set; }
Property Value
Type |
---|
System.Windows.Media.FontFamily |
MarkerLabelFontSize
Gets or sets the value for marker label font size
Declaration
public double MarkerLabelFontSize { get; set; }
Property Value
Type |
---|
System.Double |
MarkerLabelFontStyle
Gets or sets the value for marker Label font style
Declaration
public FontStyle MarkerLabelFontStyle { get; set; }
Property Value
Type |
---|
System.Windows.FontStyle |
MarkerLabelFontWeight
Gets or sets the value for marker Label font weight
Declaration
public FontWeight MarkerLabelFontWeight { get; set; }
Property Value
Type |
---|
System.Windows.FontWeight |
MarkerLabelForeground
Gets or sets the value for marker label foreground
Declaration
public Brush MarkerLabelForeground { get; set; }
Property Value
Type |
---|
System.Windows.Media.Brush |
MarkerSelectionMode
Gets or sets the marker selection mode MarkerSelectionMode on mouse click
Declaration
public MarkerSelectionMode MarkerSelectionMode { get; set; }
Property Value
Type |
---|
MarkerSelectionMode |
MarkerTemplateSelector
Gets or sets the data template selector that is used to customize the visual representation of marker in Maps.
Declaration
public DataTemplateSelector MarkerTemplateSelector { get; set; }
Property Value
Type |
---|
System.Windows.Controls.DataTemplateSelector |
Remarks
The CustomDataSymbol is set as the DataContext of MarkerTemplateSelector.
Examples
The following example shows how to use MarkerTemplateSelector in SfMap.
# [XAML](#tab/tabid-1)<Grid.Resources>
<DataTemplate x:Key="AsiaMarkerTemplate">
<Grid>
<Canvas>
<Ellipse Width="15" Height="15" Fill="Red"/>
<TextBlock HorizontalAlignment="Center" Margin="0,30,0,0" FontSize="10" FontFamily="Segoe UI" Text="{Binding Label}"/>
</Canvas>
</Grid>
</DataTemplate>
<DataTemplate x:Key="SouthAmericaMarkerTemplate">
<Grid>
<Canvas>
<Ellipse Width="15" Height="15" Fill="Blue"/>
<TextBlock HorizontalAlignment="Center" Margin="0,30,0,0" FontSize="10" FontFamily="Segoe UI" Text="{Binding Label}"/>
</Canvas>
</Grid>
</DataTemplate>
<local:CustomMarkerTemplateSelector x:Key="customMarkerTemplateSelector"
AsiaMarkerTemplate="{StaticResource AsiaMarkerTemplate}"
SouthAmericaMarkerTemplate="{StaticResource SouthAmericaMarkerTemplate}"/>
</Grid.Resources>
<syncfusion:SfMap>
<syncfusion:SfMap.Layers>
<syncfusion:ImageryLayer LayerType="OSM"
MarkerTemplateSelector="{StaticResource customMarkerTemplateSelector}"
Markers="{Binding Models}"/>
<syncfusion:ShapeFileLayer Uri="MarkerFeatureMaps.world1.shp"
MarkerTemplateSelector="{StaticResource customMarkerTemplateSelector}"
Markers="{Binding Models}"/>
</syncfusion:SfMap.Layers>
</syncfusion:SfMap>
# [C#](#tab/tabid-2)
public class Marker
{
public string Label { get; set; }
public string Longitude { get; set; }
public string Latitude { get; set; }
}
# [C#](#tab/tabid-3)
public class MapViewModel
{
public ObservableCollection<Marker> Markers { get; set; }
public MapViewModel()
{
this.Markers = new ObservableCollection<Marker>();
this.Markers.Add(new Marker() { Label = "India", Latitude = "21.0000N", Longitude = "78.0000E" });
this.Markers.Add(new Marker() { Label = "China", Latitude = "35.0000N", Longitude = "103.0000E" });
this.Models.Add(new Marker() { Label = "Brazil", Latitude = "15.7833S", Longitude = "47.8667W" });
}
}
# [C#](#tab/tabid-4)
public class CustomMarkerTemplateSelector : DataTemplateSelector
{
public DataTemplate AsiaMarkerTemplate { get; set; }
public DataTemplate SouthAmericaMarkerTemplate { get; set; }
public override DataTemplate SelectTemplate(object item, DependencyObject container)
{
if (item is CustomDataSymbol customDataSymbol && customDataSymbol.Data != null)
{
var value = customDataSymbol.Data as Marker;
if (value.Label == "India" || value.Label == "China")
{
return AsiaMarkerTemplate;
}
return SouthAmericaMarkerTemplate;
}
return base.SelectTemplate(item, container);
}
}
MarkerToolTipSettings
Gets or sets the tooltip settings for Markers in SfMap.
Declaration
public ToolTipSetting MarkerToolTipSettings { get; set; }
Property Value
Type |
---|
ToolTipSetting |
MarkerVerticalAlignment
Gets or sets the value for marker position in VerticalAlignment
Declaration
public MarkerAlignment MarkerVerticalAlignment { get; set; }
Property Value
Type |
---|
MarkerAlignment |
Methods
GeopointToViewPoint(Double, Double)
Convert latitude and longitude values to view's x and y points.
Declaration
public Point GeopointToViewPoint(double latitude, double longitude)
Parameters
Type | Name | Description |
---|---|---|
System.Double | latitude | To get latitude |
System.Double | longitude | To get longitude |
Returns
Type | Description |
---|---|
System.Windows.Point | returns the point X and point Y from latitude and longitude |
GetLatLonFromPoint(Point)
Convert point X and point Y to longitude and latitude values.
Declaration
public Point GetLatLonFromPoint(Point pointXY)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Point | pointXY | To get point x and point y |
Returns
Type |
---|
System.Windows.Point |
OnMarkerSelected(MapLayer, MarkerSelectedEventArgs)
Marker selected event for map markers.
Declaration
protected void OnMarkerSelected(MapLayer mapLayer, MarkerSelectedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MapLayer | mapLayer | Map layer. |
MarkerSelectedEventArgs | e | Marker selected event args. |
Events
MarkerSelected
Event corresponds to marker selected.It invokes once the marker selected
Declaration
public event EventHandler<MarkerSelectedEventArgs> MarkerSelected
Event Type
Type |
---|
System.EventHandler<MarkerSelectedEventArgs> |