Class SearchViewModel
Backing controller for a search experience, intended for use with SearchView. SearchView supports searching, with search-as-you-type for multiple search providers via ISearchSource.
Implements
Namespace: Esri.ArcGISRuntime.Toolkit.Maui
Assembly: Esri.ArcGISRuntime.Toolkit.Maui.dll
Syntax
public class SearchViewModel : INotifyPropertyChanged
Properties
Name | Description |
---|---|
ActivePlaceholder | Gets the correct placeholder to display in the UI. |
ActiveSource | Gets or sets the active search source, if one is selected. If there is no selection, all sources will be used for the search. |
CurrentQuery | Gets or sets the current query. |
DefaultPlaceholder | Gets or sets the default placeholder to use when there is no ActiveSource or the ActiveSource does not have a placeholder defined. Consumers should always display the ActivePlaceholder in the UI, rather than accessing this property directly. |
IgnoreAreaChangesFlag | Gets or sets a value indicating whether changes to the query area should be ignored. This is used to prevent IsEligibleForRequery becoming true because the view zoomed to a result. |
IsEligibleForRequery | Gets a value indicating whether spatial parameters have changed enough to justify displaying a 'Repeat Search Here' button. |
IsSearchInProgress | Gets a value indicating whether a search operation is in progress. |
IsSuggestInProgress | Gets a value indicating whether a suggestion request is in progress. |
IsWaiting | Gets a value indicating whether a waiting operation (search, suggestion) is in progress. |
QueryArea | Gets or sets the query area to use when searching and getting suggestions. When used in conjunction with a GeoView, this property should be set every time navigation completes, to enable automatic update of the IsEligibleForRequery property. |
QueryCenter | Gets or sets the center point around which results should be returned. |
Results | Gets the list of search results for the most-recently completed query.
Clearing a search via ClearSearch() will set this collection to |
SearchMode | Gets or sets the search mode, which defaults to Automatic. This mode controls how many results are displayed when a search is performed. |
SelectedResult | Gets or sets the selected search result. |
Sources | Gets or sets the list of available search sources, which can be updated dynamically. |
Suggestions | Gets the list of search suggestions. This value is set after calls to UpdateSuggestions(). |
Methods
Name | Description |
---|---|
AcceptSuggestion(SearchSuggestion) | Initiates a search using a suggestion as the query. |
CancelSearch() | Cancels any active search task. |
CancelSuggestion() | Cancels any active suggest task. |
ClearSearch() | Cancels any active search/suggest tasks, then clears all results and the current query. |
CommitSearch() | Submits the current query as a fresh search. |
ConfigureDefaultWorldGeocoder(CancellationToken) | Configures the viewmodel with a search source optimized for use with the Esri World Geocoder service. |
RepeatSearchHere() | Repeats the current search, with results confined to the area defined by QueryArea. |
UpdateSuggestions() | Updates Suggestions for the current query. |
Events
Name | Description |
---|---|
PropertyChanged | Occurs when a property value changes. |