Skip to main content Link Search Menu Expand Document (external link)

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
Basemap
Constraints
Geometry
SpatialReference
Field
LabelExpressionInfo
Layer
LayerObject
LegendOptions
OrderedLayerOrderBy
VisualVariable
LOD
Map
FieldInfo
FieldInfoFormat
PopupContent
PopupTemplate
Portal
PortalBasemapsSource
PortalItem
DefaultSymbol
UniqueValueRendererLegendOptions
MapFont
Symbol
MapView
WebMap
WebScene
Widget

Implements System.IAsyncDisposable

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.MapRendered Property

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

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.View Property

The parent MapView of the current component.

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

Property Value

MapView

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.OnAfterRenderAsync(System.Boolean) 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.

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.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

MapComponent.UpdateComponent() Method

Checks if the map is already rendered, and if so, performs forced updates as defined by the component type.

public virtual System.Threading.Tasks.Task UpdateComponent();

Returns

System.Threading.Tasks.Task

MapComponent.ValidateRequiredChildren() Method

When a MapView is prepared to render, this will check to make sure that all properties with the RequiredPropertyAttribute are provided.

public virtual void ValidateRequiredChildren();

Exceptions

MissingRequiredChildElementException
The consumer needs to provide the missing child component

MissingRequiredOptionsChildElementException
The consumer needs to provide ONE of the options of child components