layout: default title: MapComponent parent: Core Classes —

dymaptic.GeoBlazor.Core

dymaptic.GeoBlazor.Core.Components

MapComponent Class

The abstract base Razor Component class that all GeoBlazor components derive from.

public abstract class MapComponent : Microsoft.AspNetCore.Components.ComponentBase,
System.IAsyncDisposable

Inheritance System.Object 🡒 Microsoft.AspNetCore.Components.ComponentBase 🡒 MapComponent

Derived
ActionBase
Basemap
BasemapStyle
Constraints
Geometry
SpatialReference
ColorStop
DynamicDataSource
DynamicLayer
DynamicLayerField
Field
FieldsIndex
LabelExpressionInfo
Layer
LayerFloorInfo
LayerObject
LegendOptions
MultidimensionalSubset
OpacityStop
OrderedLayerOrderBy
SizeStop
Sublayer
TileInfo
VisualVariable
LOD
Map
ChartMediaInfoValue
ChartMediaInfoValueSeries
ExpressionInfo
FieldInfo
FieldInfoFormat
ImageMediaInfoValue
MediaInfo
PopupContent
PopupTemplate
RelatedRecordsInfoFieldOrder
Portal
PortalBasemapsSource
PortalItem
ColorRamp
DefaultSymbol
RasterStretchRenderer
UniqueValueRendererLegendOptions
MapFont
Symbol
MapView
Viewpoint
BasemapLayerListWidgetVisibleElements
Bookmark
CodedValue<T>
Domain
FormElement
FormInput
FormTemplate
LayerInfo
LegendStyle
PopupDockOptions
PopupVisibleElements
SliderTickConfig
SliderVisibleElements
Widget
HighlightOptions
LayerSearchSourceFilter
LocatorSearchSourceFilter
SearchSource

Implements System.IAsyncDisposable

Fields

MapComponent.AllowRender Field

Whether to allow the component to render on the next cycle.

public bool AllowRender;

Field Value

System.Boolean

Properties

MapComponent.ChildContent Property

ChildContent defines the ability to add other components within this component in the razor syntax.

public Microsoft.AspNetCore.Components.RenderFragment? ChildContent { get; set; }

Property Value

Microsoft.AspNetCore.Components.RenderFragment

MapComponent.Id Property

A unique identifier, used to track components across .NET and JavaScript.

public System.Guid Id { get; set; }

Property Value

System.Guid

MapComponent.JsModule Property

The reference to arcGisJsInterop.ts from .NET

public Microsoft.JSInterop.IJSObjectReference? JsModule { get; set; }

Property Value

Microsoft.JSInterop.IJSObjectReference

MapComponent.JsRuntime Property

Represents an instance of a JavaScript runtime to which calls may be dispatched.

public Microsoft.JSInterop.IJSRuntime JsRuntime { get; set; }

Property Value

Microsoft.JSInterop.IJSRuntime

MapComponent.MapRendered Property

A boolean flag that indicates that the current MapView has finished rendering.
To listen for a map rendering event, use OnViewRendered.

public bool MapRendered { get; set; }

Property Value

System.Boolean

MapComponent.Parent Property

The parent MapComponent of this component.

public dymaptic.GeoBlazor.Core.Components.MapComponent? Parent { get; set; }

Property Value

MapComponent

MapComponent.ProJsModule Property

Optional JsModule for GeoBlazor Pro

public Microsoft.JSInterop.IJSObjectReference? ProJsModule { get; set; }

Property Value

Microsoft.JSInterop.IJSObjectReference

MapComponent.ProProperties Property

Extension properties for GeoBlazor Pro

public System.Collections.Generic.Dictionary<string,object?>? ProProperties { get; set; }

Property Value

System.Collections.Generic.Dictionary<System.String,System.Object>

MapComponent.View Property

The parent MapView of the current component.

public dymaptic.GeoBlazor.Core.Components.Views.MapView? View { get; set; }

Property Value

MapView

MapComponent.Visible Property

Indicates the visibility of the component. Default value: true.

public System.Nullable<bool> Visible { get; set; }

Property Value

System.Nullable<System.Boolean>

Methods

MapComponent.Add(MapComponent) Method

Add a child component programmatically. Calls RegisterChildComponent(MapComponent) internally.

public System.Threading.Tasks.Task Add(dymaptic.GeoBlazor.Core.Components.MapComponent child);

Parameters

child MapComponent

The child component to add

Returns

System.Threading.Tasks.Task

MapComponent.AddReactiveListener(string, Action, bool) Method

Tracks any properties accessed in the

listenExpression  
``` and calls the callback when any of them change.

```csharp
public System.Threading.Tasks.Task AddReactiveListener<T>(string eventName, System.Action<T> handler, bool once=false);

Type parameters

T

The type of return value to expect in the handler.

Parameters

eventName System.String

The name of the event to add a listener for.

handler System.Action<T>

The function to call when there are changes.

once System.Boolean

Whether to fire the callback only once. Defaults to false.

Returns

System.Threading.Tasks.Task

MapComponent.AddReactiveListener(string, Func<T,Task>, bool) Method

Tracks any properties accessed in the

listenExpression  
``` and calls the callback when any of them change.

```csharp
public System.Threading.Tasks.Task AddReactiveListener<T>(string eventName, System.Func<T,System.Threading.Tasks.Task> handler, bool once=false);

Type parameters

T

The type of return value to expect in the handler.

Parameters

eventName System.String

The name of the event to add a listener for.

handler System.Func<T,System.Threading.Tasks.Task>

The function to call when the event triggers.

once System.Boolean

Whether to fire the callback only once. Defaults to false.

Returns

System.Threading.Tasks.Task

MapComponent.AddReactiveWaiter(string, Action, string, bool, bool) Method

Tracks a value in the

waitExpression  
``` and calls the callback when it becomes  
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Glossary/Truthy">truthy</a>.

```csharp
public System.Threading.Tasks.Task AddReactiveWaiter(string waitExpression, System.Action handler, string? targetName=null, bool once=false, bool initial=false);

Parameters

waitExpression System.String

Expression used to get the current value. All accessed properties will be tracked.

handler System.Action

The function to call when the value is truthy.

targetName System.String

The name of the target you are referencing in the

waitExpression  
```. For example, if the expression is  
"layer?.refresh", then the targetName should be "layer". The type of the target should also match the class on  
which this method was called.

<a name='dymaptic.GeoBlazor.Core.Components.MapComponent.AddReactiveWaiter(string,System.Action,string,bool,bool).once'></a>

`once` [System.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System.Boolean')

Whether to fire the callback only once.

<a name='dymaptic.GeoBlazor.Core.Components.MapComponent.AddReactiveWaiter(string,System.Action,string,bool,bool).initial'></a>

`initial` [System.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System.Boolean')

Whether to fire the callback immediately after initialization, if the necessary conditions are met.

#### Returns
[System.Threading.Tasks.Task](https://docs.microsoft.com/en-us/dotnet/api/System.Threading.Tasks.Task 'System.Threading.Tasks.Task')

#### Exceptions

[UnMatchedTargetNameException](dymaptic.GeoBlazor.Core.Exceptions.UnMatchedTargetNameException.html 'dymaptic.GeoBlazor.Core.Exceptions.UnMatchedTargetNameException')  
This exception is thrown when a watchExpression's target object name doesn't match the targetName parameter.

### Remarks
For adding waiters to types other than [MapView](dymaptic.GeoBlazor.Core.Components.Views.MapView.html 'dymaptic.GeoBlazor.Core.Components.Views.MapView') and [SceneView](dymaptic.GeoBlazor.Core.Components.Views.SceneView.html 'dymaptic.GeoBlazor.Core.Components.Views.SceneView'), the default  
  
```csharp  
targetName  
``` should not be relied upon. Make sure it matches the variable in your  
  
```csharp  
waitExpression  

MapComponent.AddReactiveWaiter(string, Func, string, bool, bool) Method

Tracks a value in the

waitExpression  
``` and calls the callback when it becomes  
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Glossary/Truthy">truthy</a>.

```csharp
public System.Threading.Tasks.Task AddReactiveWaiter(string waitExpression, System.Func<System.Threading.Tasks.Task> handler, string? targetName=null, bool once=false, bool initial=false);

Parameters

waitExpression System.String

Expression used to get the current value. All accessed properties will be tracked.

handler System.Func<System.Threading.Tasks.Task>

The function to call when the value is truthy.

targetName System.String

The name of the target you are referencing in the

waitExpression  
```. For example, if the expression is  
"layer?.refresh", then the targetName should be "layer". The type of the target should also match the class on  
which this method was called.

<a name='dymaptic.GeoBlazor.Core.Components.MapComponent.AddReactiveWaiter(string,System.Func_System.Threading.Tasks.Task_,string,bool,bool).once'></a>

`once` [System.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System.Boolean')

Whether to fire the callback only once.

<a name='dymaptic.GeoBlazor.Core.Components.MapComponent.AddReactiveWaiter(string,System.Func_System.Threading.Tasks.Task_,string,bool,bool).initial'></a>

`initial` [System.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System.Boolean')

Whether to fire the callback immediately after initialization, if the necessary conditions are met.

#### Returns
[System.Threading.Tasks.Task](https://docs.microsoft.com/en-us/dotnet/api/System.Threading.Tasks.Task 'System.Threading.Tasks.Task')

#### Exceptions

[UnMatchedTargetNameException](dymaptic.GeoBlazor.Core.Exceptions.UnMatchedTargetNameException.html 'dymaptic.GeoBlazor.Core.Exceptions.UnMatchedTargetNameException')  
This exception is thrown when a watchExpression's target object name doesn't match the targetName parameter.

### Remarks
For adding waiters to types other than [MapView](dymaptic.GeoBlazor.Core.Components.Views.MapView.html 'dymaptic.GeoBlazor.Core.Components.Views.MapView') and [SceneView](dymaptic.GeoBlazor.Core.Components.Views.SceneView.html 'dymaptic.GeoBlazor.Core.Components.Views.SceneView'), the default  
  
```csharp  
targetName  
``` should not be relied upon. Make sure it matches the variable in your  
  
```csharp  
waitExpression  

MapComponent.AddReactiveWatcher(string, Action, string, bool, bool) Method

Tracks any properties accessed in the

watchExpression  
``` and calls the callback when any of them change.

```csharp
public System.Threading.Tasks.Task AddReactiveWatcher<T>(string watchExpression, System.Action<T> handler, string? targetName=null, bool once=false, bool initial=false);

Type parameters

T

The type of return value to expect in the handler.

Parameters

watchExpression System.String

Expression used to get the current value. All accessed properties will be tracked.

handler System.Action<T>

The function to call when there are changes.

targetName System.String

The name of the target you are referencing in the

watchExpression  
```. For example, if the expression is  
"layer?.refresh", then the targetName should be "layer". The type of the target should also match the class on  
which this method was called.

<a name='dymaptic.GeoBlazor.Core.Components.MapComponent.AddReactiveWatcher_T_(string,System.Action_T_,string,bool,bool).once'></a>

`once` [System.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System.Boolean')

Whether to fire the callback only once.

<a name='dymaptic.GeoBlazor.Core.Components.MapComponent.AddReactiveWatcher_T_(string,System.Action_T_,string,bool,bool).initial'></a>

`initial` [System.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System.Boolean')

Whether to fire the callback immediately after initialization, if the necessary conditions are met.

#### Returns
[System.Threading.Tasks.Task](https://docs.microsoft.com/en-us/dotnet/api/System.Threading.Tasks.Task 'System.Threading.Tasks.Task')

#### Exceptions

[UnMatchedTargetNameException](dymaptic.GeoBlazor.Core.Exceptions.UnMatchedTargetNameException.html 'dymaptic.GeoBlazor.Core.Exceptions.UnMatchedTargetNameException')  
This exception is thrown when a watchExpression's target object name doesn't match the targetName parameter.

### Remarks
For adding watchers to types other than [MapView](dymaptic.GeoBlazor.Core.Components.Views.MapView.html 'dymaptic.GeoBlazor.Core.Components.Views.MapView') and [SceneView](dymaptic.GeoBlazor.Core.Components.Views.SceneView.html 'dymaptic.GeoBlazor.Core.Components.Views.SceneView'), the default  
  
```csharp  
targetName  
``` should not be relied upon. Make sure it matches the variable in your  
  
```csharp  
watchExpression  

MapComponent.AddReactiveWatcher(string, Func<T,Task>, string, bool, bool) Method

Tracks any properties accessed in the

watchExpression  
``` and calls the callback when any of them change.

```csharp
public System.Threading.Tasks.Task AddReactiveWatcher<T>(string watchExpression, System.Func<T,System.Threading.Tasks.Task> handler, string? targetName=null, bool once=false, bool initial=false);

Type parameters

T

The type of return value to expect in the handler.

Parameters

watchExpression System.String

Expression used to get the current value. All accessed properties will be tracked.

handler System.Func<T,System.Threading.Tasks.Task>

The function to call when there are changes.

targetName System.String

The name of the target you are referencing in the

watchExpression  
```. For example, if the expression is  
"layer?.refresh", then the targetName should be "layer". The type of the target should also match the class on  
which this method was called.

<a name='dymaptic.GeoBlazor.Core.Components.MapComponent.AddReactiveWatcher_T_(string,System.Func_T,System.Threading.Tasks.Task_,string,bool,bool).once'></a>

`once` [System.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System.Boolean')

Whether to fire the callback only once.

<a name='dymaptic.GeoBlazor.Core.Components.MapComponent.AddReactiveWatcher_T_(string,System.Func_T,System.Threading.Tasks.Task_,string,bool,bool).initial'></a>

`initial` [System.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System.Boolean')

Whether to fire the callback immediately after initialization, if the necessary conditions are met.

#### Returns
[System.Threading.Tasks.Task](https://docs.microsoft.com/en-us/dotnet/api/System.Threading.Tasks.Task 'System.Threading.Tasks.Task')

#### Exceptions

[UnMatchedTargetNameException](dymaptic.GeoBlazor.Core.Exceptions.UnMatchedTargetNameException.html 'dymaptic.GeoBlazor.Core.Exceptions.UnMatchedTargetNameException')  
This exception is thrown when a watchExpression's target object name doesn't match the targetName parameter.

### Remarks
For adding watchers to types other than [MapView](dymaptic.GeoBlazor.Core.Components.Views.MapView.html 'dymaptic.GeoBlazor.Core.Components.Views.MapView') and [SceneView](dymaptic.GeoBlazor.Core.Components.Views.SceneView.html 'dymaptic.GeoBlazor.Core.Components.Views.SceneView'), the default  
  
```csharp  
targetName  
``` should not be relied upon. Make sure it matches the variable in your  
  
```csharp  
watchExpression  

MapComponent.AwaitReactiveSingleWatchUpdate(string, string, CancellationToken) Method

Tracks any properties being evaluated by the getValue function. When getValue changes, it returns a Task containing
the value. This method only tracks a single change.

public System.Threading.Tasks.Task<T> AwaitReactiveSingleWatchUpdate<T>(string watchExpression, string? targetName=null, System.Threading.CancellationToken token=default(System.Threading.CancellationToken));

Type parameters

T

The expected return type.

Parameters

watchExpression System.String

The expression to be tracked.

targetName System.String

The name of the target you are referencing in the

waitExpression  
```. For example, if the expression is  
"layer?.refresh", then the targetName should be "layer". The type of the target should also match the class on  
which this method was called.

<a name='dymaptic.GeoBlazor.Core.Components.MapComponent.AwaitReactiveSingleWatchUpdate_T_(string,string,System.Threading.CancellationToken).token'></a>

`token` [System.Threading.CancellationToken](https://docs.microsoft.com/en-us/dotnet/api/System.Threading.CancellationToken 'System.Threading.CancellationToken')

Optional Cancellation Token to abort a listener.

#### Returns
[System.Threading.Tasks.Task&lt;](https://docs.microsoft.com/en-us/dotnet/api/System.Threading.Tasks.Task-1 'System.Threading.Tasks.Task`1')[T](dymaptic.GeoBlazor.Core.Components.MapComponent.html#dymaptic.GeoBlazor.Core.Components.MapComponent.AwaitReactiveSingleWatchUpdate_T_(string,string,System.Threading.CancellationToken).T 'dymaptic.GeoBlazor.Core.Components.MapComponent.AwaitReactiveSingleWatchUpdate<T>(string, string, System.Threading.CancellationToken).T')[&gt;](https://docs.microsoft.com/en-us/dotnet/api/System.Threading.Tasks.Task-1 'System.Threading.Tasks.Task`1')  
Returns the value from the evaluated property when it changes.

#### Exceptions

[UnMatchedTargetNameException](dymaptic.GeoBlazor.Core.Exceptions.UnMatchedTargetNameException.html 'dymaptic.GeoBlazor.Core.Exceptions.UnMatchedTargetNameException')  
This exception is thrown when a watchExpression's target object name doesn't match the targetName parameter.

<a name='dymaptic.GeoBlazor.Core.Components.MapComponent.DisposeAsync()'></a>

## MapComponent.DisposeAsync() Method

Implements the `IAsyncDisposable` pattern.

```csharp
public virtual System.Threading.Tasks.ValueTask DisposeAsync();

Implements DisposeAsync()

Returns

System.Threading.Tasks.ValueTask

MapComponent.OnReactiveListenerTriggered(string, Nullable) Method

JS-Invokable method that is triggered by the reactiveUtils ‘on’ listeners. This method will dynamically trigger
handlers passed to AddReactiveListener<T>(string, Func<T,Task>, bool)

public void OnReactiveListenerTriggered(string eventName, System.Nullable<System.Text.Json.JsonElement> value);

Parameters

eventName System.String

The tracked event that was triggered.

value System.Nullable<System.Text.Json.JsonElement>

The return value of the watcher callback.

MapComponent.OnReactiveWaiterTrue(string) Method

JS-Invokable method that is triggered by the reactiveUtils waiters. This method will dynamically trigger handlers
passed to AddReactiveWaiter(string, Func<Task>, string, bool, bool)

public void OnReactiveWaiterTrue(string waitExpression);

Parameters

waitExpression System.String

The tracked expression that was triggered.

MapComponent.OnReactiveWatcherUpdate(string, Nullable) Method

JS-Invokable method that is triggered by the reactiveUtils watchers. This method will dynamically trigger handlers
passed to AddReactiveWatcher<T>(string, Func<T,Task>, string, bool, bool)

public void OnReactiveWatcherUpdate(string watchExpression, System.Nullable<System.Text.Json.JsonElement> value);

Parameters

watchExpression System.String

The tracked expression that was triggered.

value System.Nullable<System.Text.Json.JsonElement>

The return value of the watcher callback.

MapComponent.Refresh() Method

Provides a way to externally call StateHasChanged on the component.

public virtual void Refresh();

MapComponent.RegisterChildComponent(MapComponent) Method

Called from dymaptic.GeoBlazor.Core.Components.MapComponent.OnInitializedAsync to “Register” the current component with it’s parent.

public virtual System.Threading.Tasks.Task RegisterChildComponent(dymaptic.GeoBlazor.Core.Components.MapComponent child);

Parameters

child MapComponent

The calling, child component to register

Returns

System.Threading.Tasks.Task

Exceptions

InvalidChildElementException
Throws if the current child is not a valid sub-component to the parent.

Remarks

This method is an implementation detail and should not be called directly by consumers. In future versions, this may be changed to an internal method. If you see no other way to register a child component, please open an issue on GitHub.

MapComponent.RemoveReactiveListener(string) Method

Removes the tracker on a particular expression.

public System.Threading.Tasks.Task RemoveReactiveListener(string eventName);

Parameters

eventName System.String

The expression to stop tracking.

Returns

System.Threading.Tasks.Task

MapComponent.RemoveReactiveWaiter(string) Method

Removes the tracker on a particular expression.

public System.Threading.Tasks.Task RemoveReactiveWaiter(string waitExpression);

Parameters

waitExpression System.String

The expression to stop tracking.

Returns

System.Threading.Tasks.Task

MapComponent.RemoveReactiveWatcher(string) Method

Removes the tracker on a particular expression.

public System.Threading.Tasks.Task RemoveReactiveWatcher(string watchExpression);

Parameters

watchExpression System.String

The expression to stop tracking.

Returns

System.Threading.Tasks.Task

MapComponent.SetParametersAsync(ParameterView) Method

Sets parameters supplied by the component’s parent in the render tree.

public override System.Threading.Tasks.Task SetParametersAsync(Microsoft.AspNetCore.Components.ParameterView parameters);

Parameters

parameters Microsoft.AspNetCore.Components.ParameterView

The parameters.

Implements SetParametersAsync(ParameterView)

Returns

System.Threading.Tasks.Task
A System.Threading.Tasks.Task that completes when the component has finished updating and rendering itself.

Remarks

Parameters are passed when Microsoft.AspNetCore.Components.ComponentBase.SetParametersAsync(Microsoft.AspNetCore.Components.ParameterView) is called. It is not required that
the caller supply a parameter value for all of the parameters that are logically understood by the component.

The default implementation of Microsoft.AspNetCore.Components.ComponentBase.SetParametersAsync(Microsoft.AspNetCore.Components.ParameterView) will set the value of each property
decorated with Microsoft.AspNetCore.Components.ParameterAttribute or Microsoft.AspNetCore.Components.CascadingParameterAttribute that has
a corresponding value in the Microsoft.AspNetCore.Components.ParameterView. Parameters that do not have a corresponding value
will be unchanged.

MapComponent.SetVisibility(bool) Method

Toggles the visibility of the component.

public System.Threading.Tasks.Task SetVisibility(bool visible);

Parameters

visible System.Boolean

The new value to set for visibility of the component.

Returns

System.Threading.Tasks.Task

MapComponent.UnregisterChildComponent(MapComponent) Method

Undoes the “Registration” of a child with its parent.

public virtual System.Threading.Tasks.Task UnregisterChildComponent(dymaptic.GeoBlazor.Core.Components.MapComponent child);

Parameters

child MapComponent

The child to unregister

Returns

System.Threading.Tasks.Task

Remarks

This method is an implementation detail and should not be called directly by consumers. In future versions, this may be changed to an internal method.