RadzenGoogleMap Class

RadzenGoogleMap component.

Inheritance

Object

ComponentBase

RadzenComponent

RadzenGoogleMap

Implements

IComponent

IHandleEvent

IHandleAfterRender

Namespace: Radzen.Blazor

Assembly: Radzen.Blazor.dll

Syntax

public class RadzenGoogleMap : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRender

Examples

<RadzenGoogleMap Zoom="3" Center=@(new GoogleMapPosition() { Lat = 42.6977, Lng = 23.3219 }) MapClick=@OnMapClick MarkerClick=@OnMarkerClick">
    <Markers>
        <RadzenGoogleMapMarker Title="London" Label="London" Position=@(new GoogleMapPosition() { Lat = 51.5074, Lng = 0.1278 }) />
        <RadzenGoogleMapMarker Title="Paris " Label="Paris" Position=@(new GoogleMapPosition() { Lat = 48.8566, Lng = 2.3522 }) />
    </Markers>
</RadzenGoogleMap>
@code {
  void OnMapClick(GoogleMapClickEventArgs args)
  {
    Console.WriteLine($"Map clicked at Lat: {args.Position.Lat}, Lng: {args.Position.Lng}");
  }

  void OnMarkerClick(RadzenGoogleMapMarker marker)
  {
    Console.WriteLine($"Map {marker.Title} marker clicked. Marker position -> Lat: {marker.Position.Lat}, Lng: {marker.Position.Lng}");
  }
}

Constructors

RadzenGoogleMaplink

RadzenGoogleMap component.

Declaration
public RadzenGoogleMap()

Properties

ApiKeylink

Gets or sets the Google API key.

Declaration
public string ApiKey { get; set; }
Property Value
Type Description
stringGets or sets the Google API key.

Centerlink

Gets or sets the center map position.

Declaration
public GoogleMapPosition Center { get; set; }
Property Value
Type Description
GoogleMapPositionGets or sets the center map position.

Datalink

Gets or sets the data - collection of RadzenGoogleMapMarker.

Declaration
public IEnumerable<RadzenGoogleMapMarker> Data { get; set; }
Property Value
Type Description
IEnumerable<RadzenGoogleMapMarker>Gets or sets the data - collection of RadzenGoogleMapMarker.

FitBoundsToMarkersOnUpdatelink

Flag indicating whether map will be zoomed to marker bounds on update or not.

Declaration
public bool FitBoundsToMarkersOnUpdate { get; set; }
Property Value
Type Description
boolFlag indicating whether map will be zoomed to marker bounds on update or not.

MapClicklink

Gets or sets the map click callback.

Declaration
public EventCallback<GoogleMapClickEventArgs> MapClick { get; set; }
Property Value
Type Description
EventCallback<GoogleMapClickEventArgs>Gets or sets the map click callback.

MapIdlink

Gets or sets the Google Map Id.

Declaration
public string MapId { get; set; }
Property Value
Type Description
stringGets or sets the Google Map Id.

MarkerClicklink

Gets or sets the marker click callback.

Declaration
public EventCallback<RadzenGoogleMapMarker> MarkerClick { get; set; }
Property Value
Type Description
EventCallback<RadzenGoogleMapMarker>Gets or sets the marker click callback.

Markerslink

Gets or sets the markers.

Declaration
public RenderFragment Markers { get; set; }
Property Value
Type Description
RenderFragmentGets or sets the markers.

Optionslink

Gets or sets the Google map options: https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions.

Declaration
public Dictionary<string, object> Options { get; set; }
Property Value
Type Description
Dictionary<string, object>Gets or sets the Google map options: https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions.

Zoomlink

Gets or sets the zoom.

Declaration
public double Zoom { get; set; }
Property Value
Type Description
doubleGets or sets the zoom.

Methods

AddMarkerlink

Adds the marker.

Declaration
public void AddMarker(RadzenGoogleMapMarker marker)
Parameters
Type Name Description
RadzenGoogleMapMarker marker The marker.

BuildRenderTreelink

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

Disposelink

Declaration
public override void Dispose()

GetComponentCssClasslink

Declaration
protected override string GetComponentCssClass()
Returns
Type Description
string

OnAfterRenderAsynclink

Declaration
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
Type Name Description
bool firstRender
Returns
Type Description
Task

OnMapClicklink

Handles the MapClick event.

Declaration
public Task OnMapClick(GoogleMapClickEventArgs args)
Parameters
Type Name Description
GoogleMapClickEventArgs args The GoogleMapClickEventArgs instance containing the event data.
Returns
Type Description
Task

OnMarkerClicklink

Called when marker click.

Declaration
public Task OnMarkerClick(RadzenGoogleMapMarker marker)
Parameters
Type Name Description
RadzenGoogleMapMarker marker The marker.
Returns
Type Description
Task

RemoveMarkerlink

Removes the marker.

Declaration
public void RemoveMarker(RadzenGoogleMapMarker marker)
Parameters
Type Name Description
RadzenGoogleMapMarker marker The marker.
An error has occurred. This app may no longer respond until reloaded. Reload 🗙