Back to Devexpress

MapControl.SearchPanelOptions Property

windowsforms-devexpress-dot-xtramap-dot-mapcontrol-fdf9f67f.md

latest4.4 KB
Original Source

MapControl.SearchPanelOptions Property

Returns search panel options.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
public MapSearchPanelOptions SearchPanelOptions { get; }
vb
Public ReadOnly Property SearchPanelOptions As MapSearchPanelOptions

Property Value

TypeDescription
MapSearchPanelOptions

Contains settings for the search panel.

|

Remarks

The map control shows the search panel if you assign a search provider to an information layer. For more information, refer to the following topic: Search.

You can use the MapControl.SearchPanelOptions property to customize the search panel. This property returns a MapSearchPanelOptions object that stores individual options. The list below describes key settings:

  • Visible – Controls search panel visibility.
  • NullValuePrompt – Specifies the prompt message text. The search panel shows this message when no search request is entered. If NullValuePrompt is not specified, the map control shows the default text. You can also disable the ShowNullValuePrompt property to hide the message.
  • MaxVisibleItemCount – Sets the number of visible search results in the search panel drop-down list.
  • Width – Specifies the search panel width in DIPs (device-independent pixels).

Example

The following example configures the search panel options such as width, prompt message, and so on:

csharp
using DevExpress.XtraMap;

    private void OnFormLoad(object sender, EventArgs e) {
        // Enable search:
        InformationLayer infoLayer = new InformationLayer();
        mapControl1.Layers.Add(infoLayer);
        BingSearchDataProvider searchProvider = new BingSearchDataProvider();
        infoLayer.DataProvider = searchProvider;
        searchProvider.BingKey = bingKey;

        // Specify search panel options:
        mapControl1.SearchPanelOptions.Visible = true;
        mapControl1.SearchPanelOptions.ShowNullValuePrompt = true;
        mapControl1.SearchPanelOptions.NullValuePrompt = "Type a location to search...";
        mapControl1.SearchPanelOptions.MaxVisibleItemCount = 3;
        mapControl1.SearchPanelOptions.Width = 200;
    }
vb
Imports DevExpress.XtraMap
    Private Sub OnFormLoad(ByVal sender As Object, ByVal e As EventArgs)
        ' Enable search:
        Dim infoLayer As InformationLayer = New InformationLayer()
        mapControl1.Layers.Add(infoLayer)
        Dim searchProvider As BingSearchDataProvider = New BingSearchDataProvider()
        infoLayer.DataProvider = searchProvider
        searchProvider.BingKey = bingKey
        ' Specify search panel options:
        mapControl1.SearchPanelOptions.Visible = True
        mapControl1.SearchPanelOptions.ShowNullValuePrompt = True
        mapControl1.SearchPanelOptions.NullValuePrompt = "Type a location to search..."
        mapControl1.SearchPanelOptions.MaxVisibleItemCount = 3
        mapControl1.SearchPanelOptions.Width = 200
    End Sub

See Also

MapControl Class

MapControl Members

DevExpress.XtraMap Namespace