Geocode Online

This sample demonstrates geocoding addresses using a LocatorTask. To use the sample, specify an address in the dialog in the upper right of the application and click the Find button. You can pan to each geocode result by selecting it from the results list in the lower right of the application.

In the code-behind, a LocatorTask is used to geocode the specified address. The resulting match candidates are then used to create Graphics and added to the map.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.AddressToLocation"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:esri="http://schemas.esri.com/arcgis/client/2009">
    <Grid x:Name="LayoutRoot" Background="White" >

        <Grid.Resources>
            <esri:PictureMarkerSymbol x:Key="DefaultMarkerSymbol" 
                OffsetX="0" OffsetY="31" Source="/Assets/Images/flag-yellow-32x32.png" />
            <LinearGradientBrush x:Key="PanelGradient" EndPoint="0.5,1" StartPoint="0.5,0">
                <LinearGradientBrush.RelativeTransform>
                    <TransformGroup>
                        <ScaleTransform CenterY="0.5" CenterX="0.5"/>
                        <SkewTransform CenterY="0.5" CenterX="0.5"/>
                        <RotateTransform Angle="176" CenterY="0.5" CenterX="0.5"/>
                        <TranslateTransform/>
                    </TransformGroup>
                </LinearGradientBrush.RelativeTransform>
                <GradientStop Color="#FF145787" Offset="0.16"/>
                <GradientStop Color="#FF3D7FAC" Offset="0.502"/>
                <GradientStop Color="#FF88C5EF" Offset="0.984"/>
            </LinearGradientBrush>
        </Grid.Resources>

        <esri:Map x:Name="MyMap" Background="#FFE3E3E3" WrapAround="True">
            <esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer" 
                      Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
            <esri:GraphicsLayer ID="CandidateGraphicsLayer">
                <esri:GraphicsLayer.MapTip>
                    <Grid>
                        <Rectangle Stroke="Gray"  RadiusX="10" RadiusY="10" Fill="#77FF0000" Margin="0,0,0,5" >
                            <Rectangle.Effect>
                                <DropShadowEffect/>
                            </Rectangle.Effect>
                        </Rectangle>
                        <Rectangle Fill="#DDFFFFFF" Stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="10,10,10,15" />
                        <StackPanel Orientation="Vertical" HorizontalAlignment="Center" Margin="30,20,30,30">
                            <TextBlock Text="{Binding [Address]}" HorizontalAlignment="Left" Foreground="Black" />
                            <TextBlock Text="{Binding [LatLon]}" HorizontalAlignment="Left" Foreground="Black" />
                        </StackPanel>
                    </Grid>
                </esri:GraphicsLayer.MapTip>
            </esri:GraphicsLayer>
        </esri:Map>

        <Grid HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,15,15,0" >
            <Rectangle Fill="{StaticResource PanelGradient}" Stroke="Gray"  RadiusX="10" RadiusY="10" Margin="0,0,0,5">
                <Rectangle.Effect>
                    <DropShadowEffect/>
                </Rectangle.Effect>
            </Rectangle>
            <Rectangle Fill="#DDFFFFFF" Stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="10,10,10,15" />
            <StackPanel Orientation="Vertical" HorizontalAlignment="Center" Margin="30,20,30,30">
                <TextBlock Text="Enter Address Information" FontWeight="Bold" HorizontalAlignment="Center" Foreground="Black" />
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" >
                    <TextBlock Text="Address: " Width="80" TextAlignment="Right" Foreground="Black"/>
                    <TextBox x:Name="Address" Text="400 Market Street" Width="125"/>
                </StackPanel>
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" >
                    <TextBlock Text="City: " Width="80" TextAlignment="Right" Foreground="Black" />
                    <TextBox x:Name="City" Text="San Francisco" Width="125"/>
                </StackPanel>
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" >
                    <TextBlock Text="State: " Width="80" TextAlignment="Right" Foreground="Black"/>
                    <TextBox x:Name="State" Text="CA" Width="125"/>
                </StackPanel>
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" >
                    <TextBlock Text="Zip: " Width="80" TextAlignment="Right" Foreground="Black"/>
                    <TextBox x:Name="Zip" Text="94111" Width="125"/>
                </StackPanel>
                <Button x:Name="FindAddressButton" Content="Find" Width="100" HorizontalAlignment="Center"
                        Click="FindAddressButton_Click" Margin="0,5,0,0" />
            </StackPanel>
        </Grid>

        <Grid x:Name="CandidatePanelGrid" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,15,15,0" Visibility="Collapsed"  >
            <Rectangle Stroke="Gray"  RadiusX="10" RadiusY="10" Fill="#775C90B2" Margin="0,0,0,5" >
                <Rectangle.Effect>
                    <DropShadowEffect/>
                </Rectangle.Effect>
            </Rectangle>
            <Rectangle Fill="#FFFFFFFF" Stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="10,17,10,15" />
            <StackPanel Orientation="Vertical" HorizontalAlignment="Center" Margin="10,2,15,15">
                <TextBlock HorizontalAlignment="Left" Text="Address Candidates" Margin="2,0,0,5" Foreground="Black" />
                <ScrollViewer x:Name="CandidateScrollViewer" Width="300" MaxHeight="150" BorderThickness="0"
                              HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" >
                    <ListBox x:Name="CandidateListBox" VerticalAlignment="Top" BorderThickness="0" 
                             SelectionChanged="_candidateListBox_SelectionChanged" />
                </ScrollViewer>
            </StackPanel>
        </Grid>

    </Grid>
</UserControl>

Sample code usage restrictions
5/16/2014