MapSearchBarElement
Represents a search bar element for map controls, providing text input and search functionality with support for various map search providers including Azure and Bing Maps.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.RadMap.dll
Syntax:
public class MapSearchBarElement : LightVisualElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IBindableComponent, IComponent, IDisposable, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode, IPrimitiveElement, IShapedElement, IFillElement, IBorderElement, IBoxStyle, IBoxElement, IDrawFillElement, IImageElement, ITextPrimitive, ITextProvider
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementRadComponentElementRadItemUIItemBaseLightVisualElementMapSearchBarElement...
Implements:
Inherited Members
Constructors
Initializes a new instance of the MapSearchBarElement class and associates it with the specified map element for search operations.
public MapSearchBarElement(RadMapElement mapElement)
The RadMapElement that this search bar will interact with for displaying search results.
Properties
Gets or sets the Azure search request configuration used for performing searches with Azure Maps services.
public AzureSearchRequest AzureSearchRequest { get; set; }
Gets the map element that this search bar is associated with for displaying search results and managing map interactions.
public RadMapElement MapElement { get; }
Gets or sets the width of the search bar in pixels, automatically scaled for DPI settings.
public int SearchBarWidth { get; set; }
Gets the search icon element that provides visual indication of the search functionality within the search bar.
public MapSearchIconElement SearchIconElement { get; }
Gets or sets the search mode that determines when search operations are triggered, such as on text change or user confirmation.
public MapSearchMode SearchMode { get; set; }
Gets or sets the search provider that will be used for performing map search operations when no event handler is provided.
public IMapBaseSearchProvider SearchProvider { get; set; }
Gets the text box element where users can enter search queries for map locations and addresses.
public RadTextBoxElement SearchTextBoxElement { get; }
Gets or sets a value indicating whether a message box should be displayed when search errors occur and no custom search provider is configured.
public bool ShowMessageBoxOnError { get; set; }
Gets the stack layout element that contains and arranges the search bar components in a horizontal layout.
public StackLayoutElement StackLayoutElement { get; }
Methods
Arranges the search bar element within the specified final size, constraining the width to the configured SearchBarWidth value.
Creates an Azure search request object for Azure Maps search operations based on the provided search text.
protected virtual AzureSearchRequest AzureBuildSearchRequest(string text)
The search text to include in the Azure search request.
Returns:An AzureSearchRequest object configured with the search parameters.
Creates a search request object for Bing Maps or other compatible search providers based on the provided search text.
protected virtual RequestBase BuildSearchRequest(string text)
The search text to include in the request.
Returns:A RequestBase object configured with the search parameters.
Creates and initializes the child elements of the search bar, including the stack layout, text box, and search icon elements.
protected override void CreateChildElements()
Overrides:
Creates and configures a search icon element that displays a visual search indicator in the search bar.
protected virtual MapSearchIconElement CreateSearchIconElement()
A configured MapSearchIconElement for the search bar.
Creates and configures a stack layout element for arranging the search bar components horizontally.
protected virtual StackLayoutElement CreateStackElement()
A configured StackLayoutElement for the search bar layout.
Creates and configures a text box element for search input, including null text, sizing, and event subscriptions.
protected virtual RadTextBoxElement CreateTextBoxElement()
A configured RadTextBoxElement for search text input.
Initializes the default field values and properties for the search bar element, including search mode, width, and error handling settings.
protected override void InitializeFields()
Overrides:
Measures the size needed for the search bar element, constraining the width to the configured SearchBarWidth value.
Handles key down events in the search text box, initiating search operations when the Enter key is pressed.
protected virtual void OnSearchTextBoxKeyDown(object sender, KeyEventArgs e)
The source of the event.
eKeyEventArgsA KeyEventArgs that contains the event data.
Handles text changed events in the search text box, triggering search operations when the search mode is set to OnTextChange.
Initiates a search operation using the specified criteria, supporting custom event handling, dedicated search providers, or automatic provider discovery.
public virtual void Search(string criteria)
The search text or criteria to use for the map search operation.
Handles the completion of search operations from Bing Maps or other search providers, creating map pins and adjusting the view to show search results.
protected virtual void SearchProviderSearchCompleted(object sender, SearchCompletedEventArgs e)
The source of the event.
eSearchCompletedEventArgsA SearchCompletedEventArgs containing the search results from the search provider.
Handles search error events from map search providers, unsubscribing from events and optionally displaying error messages to the user.
protected virtual void SearchProviderSearchError(object sender, SearchErrorEventArgs e)
The source of the event.
eSearchErrorEventArgsA SearchErrorEventArgs containing information about the search error.
Subscribes to the essential events of the text box element to handle search operations and user interactions.
protected virtual void SubscribeToTextBoxEvents(RadTextBoxElement textBox)
The RadTextBoxElement to subscribe to events for.
Unsubscribes from the essential events of the text box element to prevent memory leaks during disposal.
protected virtual void UnsubscribeToTextBoxEvents(RadTextBoxElement textBox)
The RadTextBoxElement to unsubscribe from events.
Events
Occurs when the search criteria changes, providing access to search parameters and results through event arguments.
public event EventHandler<MapSearchEventArgs> SearchCriteriaChanged