Class 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.
Inheritance
Inherited Members
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.RadMap.dll
Syntax
public class MapSearchBarElement : LightVisualElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IComponent, IDisposable, IBindableComponent, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode, IPrimitiveElement, IShapedElement, IFillElement, IBorderElement, IBoxStyle, IBoxElement, IDrawFillElement, IImageElement, ITextPrimitive, ITextProvider
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
|
RadMapElement
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
|
AzureSearchRequest
|
MapElement
Gets the map element that this search bar is associated with for displaying search results and managing map interactions.
Declaration
public RadMapElement MapElement { get; }
Property Value
|
RadMapElement
|
SearchBarWidth
Gets or sets the width of the search bar in pixels, automatically scaled for DPI settings.
Declaration
public int SearchBarWidth { get; set; }
Property Value
|
System.Int32
|
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
|
MapSearchIconElement
|
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
|
MapSearchMode
|
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
|
IMapBaseSearchProvider
|
SearchTextBoxElement
Gets the text box element where users can enter search queries for map locations and addresses.
Declaration
public RadTextBoxElement SearchTextBoxElement { get; }
Property Value
|
RadTextBoxElement
|
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.
Declaration
public bool ShowMessageBoxOnError { get; set; }
Property Value
|
System.Boolean
|
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
|
StackLayoutElement
|
Methods
ArrangeOverride(SizeF)
Arranges the search bar element within the specified final size, constraining the width to the configured SearchBarWidth value.
Declaration
protected override SizeF ArrangeOverride(SizeF finalSize)
Parameters
|
System.Drawing.SizeF
finalSize
The System.Drawing.SizeF representing the final arrangement size for the search bar. |
Returns
|
System.Drawing.SizeF
A System.Drawing.SizeF representing the actual arranged size with width limited to SearchBarWidth. |
Overrides
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
|
System.String
text
The search text to include in the Azure search request. |
Returns
|
AzureSearchRequest
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
|
System.String
text
The search text to include in the request. |
Returns
|
RequestBase
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
|
MapSearchIconElement
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
|
StackLayoutElement
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
|
RadTextBoxElement
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.
Declaration
protected override SizeF MeasureOverride(SizeF availableSize)
Parameters
|
System.Drawing.SizeF
availableSize
The System.Drawing.SizeF representing the available space for measurement. |
Returns
|
System.Drawing.SizeF
A System.Drawing.SizeF representing the measured size with width limited to SearchBarWidth. |
Overrides
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
|
System.Object
sender
The source of the event. |
|
System.Windows.Forms.KeyEventArgs
e
A System.Windows.Forms.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.
Declaration
protected virtual void OnSearchTextBoxTextChanged(object sender, EventArgs e)
Parameters
|
System.Object
sender
The source of the event. |
|
System.EventArgs
e
An System.EventArgs that contains the event data. |
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
|
System.String
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
|
System.Object
sender
The source of the event. |
|
SearchCompletedEventArgs
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
|
System.Object
sender
The source of the event. |
|
SearchErrorEventArgs
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
|
RadTextBoxElement
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
|
RadTextBoxElement
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 Type
|
System.EventHandler<MapSearchEventArgs>
|