layout: default title: SearchWidget parent: Core Classes —
dymaptic.GeoBlazor.Core
dymaptic.GeoBlazor.Core.Components.Widgets
SearchWidget Class
The Search widget provides a way to perform search operations on locator service(s), map/feature service feature
layer(s), SceneLayers with an associated feature layer, BuildingComponentSublayer with an associated feature layer,
GeoJSONLayer, CSVLayer, OGCFeatureLayer, and/or table(s). If using a locator with a geocoding service, the
findAddressCandidates operation is used, whereas queries are used on feature layers.
ArcGIS Maps SDK for JavaScript
public class SearchWidget : dymaptic.GeoBlazor.Core.Components.Widgets.Widget
Inheritance System.Object 🡒 Microsoft.AspNetCore.Components.ComponentBase 🡒 MapComponent 🡒 Widget 🡒 SearchWidget
Properties
SearchWidget.ActiveMenu Property
Sets the current active menu of the Search widget. Default value is None.
public System.Nullable<dymaptic.GeoBlazor.Core.Components.Widgets.SearchMenu> ActiveMenu { get; set; }
Property Value
SearchWidget.ActiveSourceIndex Property
Sets the selected source’s index. Default value is 0.
public System.Nullable<int> ActiveSourceIndex { get; set; }
Property Value
SearchWidget.AllPlaceholder Property
String value used as a hint for input text when searching on multiple sources. See the image below to view the location and style of this text in the context of the widget.
Default Value: “Find address or place”
public string? AllPlaceholder { get; set; }
Property Value
SearchWidget.AutoSelect Property
Indicates whether to automatically select and zoom to the first geocoded result. If false, the findAddressCandidates operation will still geocode the input string, but the top result will not be selected. To work with the geocoded results, you can set up a search-complete event handler and get the results through the event object.
Default value is True.
public System.Nullable<bool> AutoSelect { get; set; }
Property Value
System.Nullable<System.Boolean>
SearchWidget.Disabled Property
When true, the widget is visually withdrawn and cannot be interacted with. Default value is False.
public System.Nullable<bool> Disabled { get; set; }
Property Value
System.Nullable<System.Boolean>
SearchWidget.GoToOverride Property
This function provides the ability to override either the MapView goTo() or SceneView goTo() methods with your own implementation.
public System.Action<dymaptic.GeoBlazor.Core.Components.Widgets.GoToOverrideParameters>? GoToOverride { get; set; }
Property Value
System.Action<GoToOverrideParameters>
SearchWidget.HasGoToOverride Property
Identifies whether a custom GoToOverride was registered.
public bool HasGoToOverride { get; }
Property Value
SearchWidget.IncludeDefaultSources Property
Indicates whether or not to include defaultSources in the Search UI.
public System.Nullable<bool> IncludeDefaultSources { get; set; }
Property Value
System.Nullable<System.Boolean>
SearchWidget.Label Property
The widget’s default label.
public string? Label { get; set; }
Property Value
SearchWidget.LocationEnabled Property
Enables location services within the widget. Default value is True.
public System.Nullable<bool> LocationEnabled { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
The use of this property is only supported on secure origins. To use it, switch your application to a secure origin, such as HTTPS. Note that localhost is considered “potentially secure” and can be used for easy testing in browsers that supports Window.isSecureContext (currently Chrome and Firefox).
SearchWidget.MaxResults Property
The maximum number of results returned by the widget if not specified by the source. Default value is 6.
public System.Nullable<int> MaxResults { get; set; }
Property Value
SearchWidget.MaxSuggestions Property
The maximum number of suggestions returned by the widget if not specified by the source.
If working with the default ArcGIS Online Geocoding service, the default remains at 5.
Default Value:6
public System.Nullable<int> MaxSuggestions { get; set; }
Property Value
SearchWidget.MinSuggestCharacters Property
The minimum number of characters needed for the search if not specified by the source.
Default Value:3
public System.Nullable<int> MinSuggestCharacters { get; set; }
Property Value
SearchWidget.OnSearchSelectResultEvent Property
A delegate for a handler of search selection result events.
Function must take in a SearchResult parameter, and return a System.Threading.Tasks.Task
public Microsoft.AspNetCore.Components.EventCallback<dymaptic.GeoBlazor.Core.Objects.SearchResult> OnSearchSelectResultEvent { get; set; }
Property Value
Microsoft.AspNetCore.Components.EventCallback<SearchResult>
SearchWidget.PopupEnabled Property
Indicates whether to display the Popup on feature click. The graphic can be clicked to display a Popup.
Default Value:true
public System.Nullable<bool> PopupEnabled { get; set; }
Property Value
System.Nullable<System.Boolean>
SearchWidget.PopupTemplate Property
A customized PopupTemplate for the selected feature. Note that any templates defined on allSources take precedence over those defined directly on the template.
public dymaptic.GeoBlazor.Core.Components.Popups.PopupTemplate? PopupTemplate { get; set; }
Property Value
SearchWidget.Portal Property
It is possible to search a specified portal instance’s locator services Use this property to set this ArcGIS Portal instance to search.
public dymaptic.GeoBlazor.Core.Components.Portal? Portal { get; set; }
Property Value
SearchWidget.ResultGraphicEnabled Property
Indicates if the resultGraphic will display at the location of the selected feature.
Default Value:true
public System.Nullable<bool> ResultGraphicEnabled { get; set; }
Property Value
System.Nullable<System.Boolean>
SearchWidget.SearchAllEnabled Property
Indicates whether to display the option to search all sources. When true, the “All” option is displayed by default. When false, no option to search all sources at once is available.
Default Value is True.
public System.Nullable<bool> SearchAllEnabled { get; set; }
Property Value
System.Nullable<System.Boolean>
SearchWidget.SearchTerm Property
The value of the search box input text string.
public string? SearchTerm { get; set; }
Property Value
Remarks
Only use to set an initial value. Use SetSearchTerm() and GetSearchTerm() to update or read.
SearchWidget.SearchWidgetObjectReference Property
A .NET object reference for calling this class from JavaScript.
public Microsoft.JSInterop.DotNetObjectReference<dymaptic.GeoBlazor.Core.Components.Widgets.SearchWidget> SearchWidgetObjectReference { get; }
Property Value
Microsoft.JSInterop.DotNetObjectReference<SearchWidget>
SearchWidget.Sources Property
The Search widget may be used to search features in a map/feature service feature layer(s), SceneLayers with an associated feature layer, BuildingComponentSublayer with an associated feature layer, GeoJSONLayer, CSVLayer or OGCFeatureLayer, or table, or geocode locations with a locator. The sources property defines the sources from which to search for the view specified by the Search widget instance.
There are two types of sources: LayerSearchSource and LocatorSearchSource. Any combination of these sources may be used together in the same instance of the Search widget.
public System.Collections.Generic.List<dymaptic.GeoBlazor.Core.Objects.SearchSource>? Sources { get; set; }
Property Value
System.Collections.Generic.List<SearchSource>
Remarks
Feature layers created from client-side graphics are not supported.
SearchWidget.SuggestionsEnabled Property
Enable suggestions for the widget.
This is only available if working with a 10.3 or greater geocoding service that has suggest capability loaded or a 10.3 or greater feature layer that supports pagination, i.e. supportsPagination = true.
Default Value:true
public System.Nullable<bool> SuggestionsEnabled { get; set; }
Property Value
System.Nullable<System.Boolean>
SearchWidget.WidgetType Property
The type of widget
public override string WidgetType { get; }
Property Value
Methods
SearchWidget.GetActiveMenu() Method
Retrieves the current active menu of the Search widget. Default value is None.
public System.Threading.Tasks.Task<dymaptic.GeoBlazor.Core.Components.Widgets.SearchMenu> GetActiveMenu();
Returns
System.Threading.Tasks.Task<SearchMenu>
SearchWidget.GetActiveSource() Method
Retrieves the source object currently selected. Can be either a LayerSearchSource or a LocatorSearchSource.
public System.Threading.Tasks.Task<dymaptic.GeoBlazor.Core.Objects.SearchSource?> GetActiveSource();
Returns
System.Threading.Tasks.Task<SearchSource>
SearchWidget.GetActiveSourceIndex() Method
Retrieves the index of the currently selected source. This value is -1 when all sources are selected.
public System.Threading.Tasks.Task<int> GetActiveSourceIndex();
Returns
System.Threading.Tasks.Task<System.Int32>
SearchWidget.GetAllSources() Method
Retrieves the combined collection of defaultSources and sources. The defaultSources displays first in the Search UI.
public System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<dymaptic.GeoBlazor.Core.Objects.SearchSource>> GetAllSources();
Returns
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<SearchSource>>
SearchWidget.GetDefaultSources() Method
Retrieves a Collection of LayerSearchSource and/or LocatorSearchSource. This may contain ArcGIS Portal locators and any web map or web scene configurable search sources. Web maps or web scenes may contain map/feature service feature layer(s), and/or table(s) as sources.
public System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<dymaptic.GeoBlazor.Core.Objects.SearchSource>> GetDefaultSources();
Returns
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<SearchSource>>
SearchWidget.GetResultGraphic() Method
The graphic used to highlight the resulting feature or location.
public System.Threading.Tasks.Task<dymaptic.GeoBlazor.Core.Components.Layers.Graphic?> GetResultGraphic();
Returns
System.Threading.Tasks.Task<Graphic>
Remarks
A graphic will be placed in the View’s graphics for layer views that do not support the highlight method.
SearchWidget.GetResults() Method
Retrieves an array of objects, each containing a SearchResult from the search.
public System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<dymaptic.GeoBlazor.Core.Objects.SearchResultResponse>> GetResults();
Returns
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<SearchResultResponse>>
SearchWidget.GetSearchTerm() Method
Retrieves the current value of the search text box.
public System.Threading.Tasks.Task<string> GetSearchTerm();
Returns
System.Threading.Tasks.Task<System.String>
SearchWidget.GetSelectedResult() Method
Retrieves the result selected from a search.
public System.Threading.Tasks.Task<dymaptic.GeoBlazor.Core.Objects.SearchResult> GetSelectedResult();
Returns
System.Threading.Tasks.Task<SearchResult>
SearchWidget.GetSuggestions() Method
Retrieves an array of results from the suggest method.
This is available if working with a 10.3 or greater geocoding service that has suggest capability loaded or a 10.3 or greater feature layer that supports pagination, i.e. supportsPagination = true.
public System.Threading.Tasks.Task<dymaptic.GeoBlazor.Core.Objects.SuggestResult[]> GetSuggestions();
Returns
System.Threading.Tasks.Task<SuggestResult[]>
SearchWidget.OnJavaScriptGoToOverride(GoToOverrideParameters) Method
JavaScript-invokable method for internal use
public void OnJavaScriptGoToOverride(dymaptic.GeoBlazor.Core.Components.Widgets.GoToOverrideParameters goToOverrideParams);
Parameters
goToOverrideParams
GoToOverrideParameters
SearchWidget.OnJavaScriptSearchSelectResult(SearchResult) Method
A JavaScript invokable method that is triggered whenever a “select-result” event is fired by the search widget.
public System.Threading.Tasks.Task OnJavaScriptSearchSelectResult(dymaptic.GeoBlazor.Core.Objects.SearchResult searchResult);
Parameters
searchResult
SearchResult
The result selected in the search widget.
Returns
SearchWidget.RegisterChildComponent(MapComponent) Method
Called from dymaptic.GeoBlazor.Core.Components.MapComponent.OnInitializedAsync to “Register” the current component with it’s parent.
public override System.Threading.Tasks.Task RegisterChildComponent(dymaptic.GeoBlazor.Core.Components.MapComponent child);
Parameters
child
MapComponent
The calling, child component to register
Returns
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.
SearchWidget.Search(double[][]) Method
Depending on the sources specified, search() queries the feature layer(s) and/or performs address matching using any specified locator(s) and returns any applicable results.
public System.Threading.Tasks.Task<dymaptic.GeoBlazor.Core.Objects.SearchResponse> Search(double[][] searchTerm);
Parameters
searchTerm
System.Double[][]
The array of long/lat coordinate pairs to search for.
Returns
System.Threading.Tasks.Task<SearchResponse>
SearchWidget.Search(Geometry) Method
Depending on the sources specified, search() queries the feature layer(s) and/or performs address matching using any specified locator(s) and returns any applicable results.
public System.Threading.Tasks.Task<dymaptic.GeoBlazor.Core.Objects.SearchResponse> Search(dymaptic.GeoBlazor.Core.Components.Geometries.Geometry searchTerm);
Parameters
searchTerm
Geometry
The geometry to search for.
Returns
System.Threading.Tasks.Task<SearchResponse>
SearchWidget.Search(SuggestResult) Method
Depending on the sources specified, search() queries the feature layer(s) and/or performs address matching using any specified locator(s) and returns any applicable results.
public System.Threading.Tasks.Task<dymaptic.GeoBlazor.Core.Objects.SearchResponse> Search(dymaptic.GeoBlazor.Core.Objects.SuggestResult searchTerm);
Parameters
searchTerm
SuggestResult
The SuggestResult to search for.
Returns
System.Threading.Tasks.Task<SearchResponse>
SearchWidget.Search(string) Method
Depending on the sources specified, search() queries the feature layer(s) and/or performs address matching using any specified locator(s) and returns any applicable results.
public System.Threading.Tasks.Task<dymaptic.GeoBlazor.Core.Objects.SearchResponse> Search(string searchTerm);
Parameters
searchTerm
System.String
The term to search for.
Returns
System.Threading.Tasks.Task<SearchResponse>
SearchWidget.SetSearchTerm(string) Method
Set the value of the search text box programmatically.
public System.Threading.Tasks.Task SetSearchTerm(string searchTerm);
Parameters
searchTerm
System.String
Returns
SearchWidget.Suggest(string) Method
Performs a suggest() request on the active Locator. It also uses the current value of the widget or one that is passed in.
public System.Threading.Tasks.Task<dymaptic.GeoBlazor.Core.Objects.SuggestResponse> Suggest(string? value=null);
Parameters
value
System.String
The string value used to suggest() on an active Locator or feature layer. If nothing is passed in, takes the current value of the widget.
Returns
System.Threading.Tasks.Task<SuggestResponse>
Remarks
Suggestions are available if working with a 10.3 or greater geocoding service that has suggest capability loaded or a 10.3 or greater feature layer that supports pagination, i.e. supportsPagination = true.
SearchWidget.UnregisterChildComponent(MapComponent) Method
Undoes the “Registration” of a child with its parent.
public override System.Threading.Tasks.Task UnregisterChildComponent(dymaptic.GeoBlazor.Core.Components.MapComponent child);
Parameters
child
MapComponent
The child to unregister
Returns
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.