menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SfMaps - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class SfMaps

    The Maps component is ideal for rendering maps from GeoJSON data or other map providers like OpenStreetMap, Google maps and Bing maps. Its rich feature set includes markers, labels, bubbles, navigation lines, legends, tooltips, zooming, panning, and much more.

    Inheritance
    System.Object
    SfBaseComponent
    SfMaps
    Inherited Members
    SfBaseComponent.Dispose()
    SfBaseComponent.OnObservableChange(String, Object, Boolean, NotifyCollectionChangedEventArgs)
    Namespace: Syncfusion.Blazor.Maps
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class SfMaps : SfBaseComponent

    Constructors

    SfMaps()

    Declaration
    public SfMaps()

    Properties

    AllowImageExport

    Enables or disables the export to image functionality in the map.

    Declaration
    public bool AllowImageExport { get; set; }
    Property Value
    Type Description
    System.Boolean

    true to enable the image export option; otherwise, false.

    Remarks

    When enabled, this allows users to export the map as an image file.

    AllowPdfExport

    Enables or disables the export to PDF functionality in the map.

    Declaration
    public bool AllowPdfExport { get; set; }
    Property Value
    Type Description
    System.Boolean

    true to enable the PDF export option; otherwise, false.

    Remarks

    This feature allows users to export the map as a PDF document when enabled.

    AllowPrint

    Enables or disables the print functionality in the map.

    Declaration
    public bool AllowPrint { get; set; }
    Property Value
    Type Description
    System.Boolean

    true to enable the print option; otherwise, false.

    Remarks

    When enabled, this allows users to print the map directly from the browser.

    Background

    Sets and gets the background color of the maps container.

    Declaration
    public string Background { get; set; }
    Property Value
    Type Description
    System.String

    A string specifying the background color of the map, in hex code, rgba string, or other valid CSS color strings.

    Remarks

    This property changes the background color of the entire map container.

    BaseLayerIndex

    Sets and gets the base layer index of the map.

    Declaration
    public int BaseLayerIndex { get; set; }
    Property Value
    Type Description
    System.Int32

    An int value representing the layer index for the map component.

    Remarks

    Use this property to specify which base layer should be visible in the map.

    ChildContent

    Sets and gets the content of the UI element.

    Declaration
    public RenderFragment ChildContent { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.RenderFragment

    A Microsoft.AspNetCore.Components.RenderFragment that defines the content of the UI element within the map.

    Remarks

    Use this property to include custom UI components or content within the map component.

    Description

    Sets and gets the description for the map.

    Declaration
    public string Description { get; set; }
    Property Value
    Type Description
    System.String

    A string providing additional information about the map.

    Remarks

    This description is useful for screen readers and assistive technologies to describe the content or purpose of the map.

    EnableGroupingSeparator

    Enables or disables the visibility state of the separator for grouping.

    Declaration
    public bool EnableGroupingSeparator { get; set; }
    Property Value
    Type Description
    System.Boolean

    true to enable the grouping separator; otherwise, false. The default value is true.

    Remarks

    Enable this option to display group separators in labels for enhanced readability of large numbers.

    EnablePersistence

    Enables or disables the persistence of the map's state.

    Declaration
    public bool EnablePersistence { get; set; }
    Property Value
    Type Description
    System.Boolean

    true to enable persistence; otherwise, false.

    Remarks

    Persistence saves the current state of the map and restores it upon reload, allowing for a consistent user experience.

    Format

    Sets and gets the format in which text in the maps are to be rendered.

    Declaration
    public string Format { get; set; }
    Property Value
    Type Description
    System.String

    A string specifying the text format for the map.

    Remarks

    This property allows customization of the text format, such as number formats and date formats, displayed on the map.

    Height

    Sets and gets the height at which the map is to be rendered.

    Declaration
    public string Height { get; set; }
    Property Value
    Type Description
    System.String

    A string specifying the map's height, such as '100px' or '100%'.

    Remarks

    If set to a percentage, the map will occupy that percentage of its parent container's height.

    ID

    Sets the ID string for the map component.

    Declaration
    public string ID { get; set; }
    Property Value
    Type Description
    System.String

    A string that specifies the unique identifier for the map component.

    Remarks

    This property is used to assign a specific ID to the map for identification and manipulation within the DOM.

    ProjectionType

    Sets and gets the projection type for the map.

    Declaration
    public ProjectionType ProjectionType { get; set; }
    Property Value
    Type Description
    ProjectionType

    A value of the ProjectionType enumeration specifying the type of projection for the map. The default value is Mercator.

    Remarks

    Projection type affects the appearance and scale of the map and can be set to types like Mercator, Miller, or Equirectangular.

    Theme

    Sets and gets the theme supported for the map.

    Declaration
    public Theme Theme { get; set; }
    Property Value
    Type Description
    Theme

    Accepts a value from the Theme enum. The default value is Material.

    Remarks

    Themes change the visual style and appearance of the map to suit different design preferences.

    TooltipDisplayMode

    Sets and gets the mode in which the tooltip is to be displayed.

    Declaration
    public TooltipGesture TooltipDisplayMode { get; set; }
    Property Value
    Type Description
    TooltipGesture

    A value of the TooltipGesture enumeration specifying the gesture to display tooltips, such as MouseMove, Click, or DoubleClick.

    Remarks

    Tooltips provide interactive feedback to users when they interact with map elements, and their display can be controlled by different gestures.

    Width

    Sets and gets the width at which the map is to be rendered.

    Declaration
    public string Width { get; set; }
    Property Value
    Type Description
    System.String

    A string specifying the map's width, such as '100px' or '100%'.

    Remarks

    If set to a percentage, the map will occupy that percentage of its parent container's width.

    Methods

    BuildRenderTree(RenderTreeBuilder)

    Declaration
    protected override void BuildRenderTree(RenderTreeBuilder __builder)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder

    Dispose(Boolean)

    Disposes the property values during the destroy of the component that is hold up for the execution of the component.

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing
    Overrides
    SfBaseComponent.Dispose(Boolean)

    ExportAsync(ExportType, String, Nullable<PdfPageOrientation>, Boolean)

    Exports the maps component to an image or PDF document asynchronously.

    Declaration
    public Task<string> ExportAsync(ExportType type, string fileName, Nullable<PdfPageOrientation> orientation = null, bool allowDownload = true)
    Parameters
    Type Name Description
    ExportType type

    The desired export format (e.g., PDF, PNG, JPEG).

    System.String fileName

    The filename to use for the exported document.

    System.Nullable<Syncfusion.PdfExport.PdfPageOrientation> orientation

    The orientation of the PDF document, if applicable.

    System.Boolean allowDownload

    Whether to download the file (true) or return a base64 string (false).

    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    A System.Threading.Tasks.Task<> representing the asynchronous operation, containing the export result as a System.String.

    GetBingUrlTemplate(String)

    This method is used to get the bing maps url.

    Declaration
    public static Task<string> GetBingUrlTemplate(string url)
    Parameters
    Type Name Description
    System.String url

    The URL of the Bing maps service.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    A System.Threading.Tasks.Task<> representing the asynchronous operation, containing the URL template for Bing maps as a System.String.

    GetMinMaxLatitudeLongitude()

    This method provides the minimum and maximum latitude and longitude values of the visible area in the Maps.

    Declaration
    public MinMaxLatitudeLongitude GetMinMaxLatitudeLongitude()
    Returns
    Type
    MinMaxLatitudeLongitude

    OnAfterRenderAsync(Boolean)

    OnAfterRenderAsync is a lifecycle method that is invoked each time the component is rendered in the application.

    Declaration
    protected override Task OnAfterRenderAsync(bool firstRender)
    Parameters
    Type Name Description
    System.Boolean firstRender

    represents the method hitting counts.

    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task representing the asynchronous operation.

    Overrides
    SfBaseComponent.OnAfterRenderAsync(Boolean)

    OnComponentParametersSet()

    OnParametersSetAsync is a lifecycle method that is invoked when the component has received parameters, and the incoming values have been assigned to the properties.

    Declaration
    protected Task OnComponentParametersSet()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task representing the asynchronous operation.

    OnInitializedAsync()

    OnInitializedAsync method is called when the component has received its initial parameters.

    Declaration
    protected override Task OnInitializedAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task representing the asynchronous operation.

    Overrides
    SfBaseComponent.OnInitializedAsync()

    OnParametersSetAsync()

    OnParametersSetAsync is a lifecycle method that is invoked when the component has received parameters, and the incoming values have been assigned to the properties.

    Declaration
    protected override Task OnParametersSetAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task representing the asynchronous operation.

    PrintAsync()

    This method handles the printing functionality for the maps component.

    Declaration
    public Task PrintAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task representing the asynchronous operation.

    Refresh()

    The method is used to render the maps again.

    Declaration
    public void Refresh()

    ShapeSelectionAsync(Int32, String, String, Boolean)

    Selects or unselects a geometric shape element in the maps component based on specified criteria.

    Declaration
    public Task ShapeSelectionAsync(int layerIndex, string propertyName, string name, bool enable = true)
    Parameters
    Type Name Description
    System.Int32 layerIndex

    The index of the layer containing the shape.

    System.String propertyName

    The property path for map shape data to identify the shape.

    System.String name

    The shape data path in the layer's data source.

    System.Boolean enable

    Specifies whether to select (true) or unselect (false) the shape. Default is true.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous operation.

    ShouldRender()

    Declaration
    protected override bool ShouldRender()
    Returns
    Type
    System.Boolean

    ZoomByPosition(MapsCenterPosition, Double)

    Zooms the map to a specific position with a specified zoom factor asynchronously.

    Declaration
    public Task ZoomByPosition(MapsCenterPosition centerPosition, double zoomFactor)
    Parameters
    Type Name Description
    MapsCenterPosition centerPosition

    The center position of the map.

    System.Double zoomFactor

    The zoom level to set for the map.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous operation.

    ZoomToCoordinates(Double, Double, Double, Double)

    Zooms the maps component based on provided geographical coordinates.

    Declaration
    public Task ZoomToCoordinates(double minLatitude, double minLongitude, double maxLatitude, double maxLongitude)
    Parameters
    Type Name Description
    System.Double minLatitude

    The minimum latitude for zooming.

    System.Double minLongitude

    The minimum longitude for zooming.

    System.Double maxLatitude

    The maximum latitude for zooming.

    System.Double maxLongitude

    The maximum longitude for zooming.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous operation.

    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved