ClassMapSearchBarElement
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
MapSearchBarElement(RadMapElement)
Initializes a new instance of the MapSearchBarElement class and associates it with the specified map element for search operations.
Declaration
public MapSearchBarElement(RadMapElement mapElement)
Parameters
mapElement
The RadMapElement that this search bar will interact with for displaying search results.
Properties
AzureSearchRequest
Gets or sets the Azure search request configuration used for performing searches with Azure Maps services.
Declaration
public AzureSearchRequest AzureSearchRequest { get; set; }
Property Value
MapElement
Gets the map element that this search bar is associated with for displaying search results and managing map interactions.
SearchBarWidth
Gets or sets the width of the search bar in pixels, automatically scaled for DPI settings.
SearchIconElement
Gets the search icon element that provides visual indication of the search functionality within the search bar.
Declaration
public MapSearchIconElement SearchIconElement { get; }
Property Value
SearchMode
Gets or sets the search mode that determines when search operations are triggered, such as on text change or user confirmation.
Declaration
public MapSearchMode SearchMode { get; set; }
Property Value
SearchProvider
Gets or sets the search provider that will be used for performing map search operations when no event handler is provided.
Declaration
public IMapBaseSearchProvider SearchProvider { get; set; }
Property Value
SearchTextBoxElement
Gets the text box element where users can enter search queries for map locations and addresses.
Declaration
public RadTextBoxElement SearchTextBoxElement { get; }
Property Value
ShowMessageBoxOnError
Gets or sets a value indicating whether a message box should be displayed when search errors occur and no custom search provider is configured.
StackLayoutElement
Gets the stack layout element that contains and arranges the search bar components in a horizontal layout.
Declaration
public StackLayoutElement StackLayoutElement { get; }
Property Value
Methods
ArrangeOverride(SizeF)
Arranges the search bar element within the specified final size, constraining the width to the configured SearchBarWidth value.
AzureBuildSearchRequest(string)
Creates an Azure search request object for Azure Maps search operations based on the provided search text.
Declaration
protected virtual AzureSearchRequest AzureBuildSearchRequest(string text)
Parameters
text
The search text to include in the Azure search request.
Returns
An AzureSearchRequest object configured with the search parameters.
BuildSearchRequest(string)
Creates a search request object for Bing Maps or other compatible search providers based on the provided search text.
Declaration
protected virtual RequestBase BuildSearchRequest(string text)
Parameters
text
The search text to include in the request.
Returns
A RequestBase object configured with the search parameters.
CreateChildElements()
Creates and initializes the child elements of the search bar, including the stack layout, text box, and search icon elements.
Declaration
protected override void CreateChildElements()
Overrides
CreateSearchIconElement()
Creates and configures a search icon element that displays a visual search indicator in the search bar.
Declaration
protected virtual MapSearchIconElement CreateSearchIconElement()
Returns
A configured MapSearchIconElement for the search bar.
CreateStackElement()
Creates and configures a stack layout element for arranging the search bar components horizontally.
Declaration
protected virtual StackLayoutElement CreateStackElement()
Returns
A configured StackLayoutElement for the search bar layout.
CreateTextBoxElement()
Creates and configures a text box element for search input, including null text, sizing, and event subscriptions.
Declaration
protected virtual RadTextBoxElement CreateTextBoxElement()
Returns
A configured RadTextBoxElement for search text input.
InitializeFields()
Initializes the default field values and properties for the search bar element, including search mode, width, and error handling settings.
Declaration
protected override void InitializeFields()
Overrides
MeasureOverride(SizeF)
Measures the size needed for the search bar element, constraining the width to the configured SearchBarWidth value.
OnSearchTextBoxKeyDown(object, KeyEventArgs)
Handles key down events in the search text box, initiating search operations when the Enter key is pressed.
Declaration
protected virtual void OnSearchTextBoxKeyDown(object sender, KeyEventArgs e)
Parameters
sender
The source of the event.
e
A KeyEventArgs that contains the event data.
OnSearchTextBoxTextChanged(object, EventArgs)
Handles text changed events in the search text box, triggering search operations when the search mode is set to OnTextChange.
Search(string)
Initiates a search operation using the specified criteria, supporting custom event handling, dedicated search providers, or automatic provider discovery.
Declaration
public virtual void Search(string criteria)
Parameters
criteria
The search text or criteria to use for the map search operation.
SearchProviderSearchCompleted(object, SearchCompletedEventArgs)
Handles the completion of search operations from Bing Maps or other search providers, creating map pins and adjusting the view to show search results.
Declaration
protected virtual void SearchProviderSearchCompleted(object sender, SearchCompletedEventArgs e)
Parameters
sender
The source of the event.
e
A SearchCompletedEventArgs containing the search results from the search provider.
SearchProviderSearchError(object, SearchErrorEventArgs)
Handles search error events from map search providers, unsubscribing from events and optionally displaying error messages to the user.
Declaration
protected virtual void SearchProviderSearchError(object sender, SearchErrorEventArgs e)
Parameters
sender
The source of the event.
e
A SearchErrorEventArgs containing information about the search error.
SubscribeToTextBoxEvents(RadTextBoxElement)
Subscribes to the essential events of the text box element to handle search operations and user interactions.
Declaration
protected virtual void SubscribeToTextBoxEvents(RadTextBoxElement textBox)
Parameters
textBox
The RadTextBoxElement to subscribe to events for.
UnsubscribeToTextBoxEvents(RadTextBoxElement)
Unsubscribes from the essential events of the text box element to prevent memory leaks during disposal.
Declaration
protected virtual void UnsubscribeToTextBoxEvents(RadTextBoxElement textBox)
Parameters
textBox
The RadTextBoxElement to unsubscribe from events.
Events
SearchCriteriaChanged
Occurs when the search criteria changes, providing access to search parameters and results through event arguments.
Declaration
public event EventHandler<MapSearchEventArgs> SearchCriteriaChanged
Event Value