Find Address

This sample demonstrates how you can use the LocatorTask API to geocode an address and display it with a pin on the map. Tapping the pin displays the reverse-geocoded address in a callout.

Find an address or place

Code

<UserControl
    x:Class="ArcGISRuntime.UWP.Samples.FindAddress.FindAddress"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup>
                <!-- Adapt screen to more than 780 effective pixels -->
                <VisualState>
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="720" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="appBar.(Grid.Row)" Value="0" />
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>
        <esriUI:MapView x:Name="MyMapView" Grid.Row="1" />
        <CommandBar x:Name="appBar" Grid.Row="2">
            <AppBarButton Icon="Find" Label="Search" Name="MyAppBarSearchButton" IsEnabled="False" AllowFocusOnInteraction="True">
                <AppBarButton.Flyout>
                    <Flyout>
                        <StackPanel Width="200">
                            <TextBox x:Name="MySearchBox" PlaceholderText="Esri" Width="200" />
                            <Button Content="Search" Click="SearchButton_Click" Width="200" />
                        </StackPanel>
                    </Flyout>
                </AppBarButton.Flyout>
            </AppBarButton>
            <AppBarButton Icon="List" Label="Suggest" Name="MyAppBarSuggestButton" IsEnabled="False">
                <AppBarButton.Flyout>
                    <MenuFlyout>
                        <MenuFlyout.Items>
                            <MenuFlyoutItem Text="277 N Avenida Caballeros, Palm Springs, CA" Click="OnSuggestionChosen" />
                            <MenuFlyoutItem Text="380 New York St, Redlands, CA 92373" Click="OnSuggestionChosen" />
                            <MenuFlyoutItem Text="Београд" Click="OnSuggestionChosen" />
                            <MenuFlyoutItem Text="Москва" Click="OnSuggestionChosen" />
                            <MenuFlyoutItem Text="北京" Click="OnSuggestionChosen" />
                        </MenuFlyout.Items>
                    </MenuFlyout>
                </AppBarButton.Flyout>
            </AppBarButton>
        </CommandBar>
    </Grid>
</UserControl>


In this topic
  1. Code