Find a route

This sample demonstrates how to solve for the best route between two locations on the map and display driving directions between them.

Route and driving directions

Code

<UserControl x:Class="ArcGISRuntime.WPF.Samples.FindRoute.FindRoute"
             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:esri="http://schemas.esri.com/arcgis/runtime/2013"
             mc:Ignorable="d">
    <Grid>
        <esri:MapView x:Name="MyMapView"/>
        <Border Background="WhiteSmoke" Opacity=".85" BorderBrush="Black" BorderThickness="1"
                HorizontalAlignment="Left" VerticalAlignment="Top"
                Margin="30" Padding="20" Width="375">
            <StackPanel>
                <TextBlock Text="Route directions:" 
                           Margin="0,0,0,2" />
                <ListBox x:Name="DirectionsListBox"
                         Width="325" Height="300">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding DirectionText}"/>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
                <Button x:Name="SolveRouteButton"
                        HorizontalAlignment="Stretch"
                        Height="30"
                        Margin="0,5"
                        Content="Solve Route"
                        Click="SolveRouteClick"/>
                <Button x:Name="ResetButton"
                        HorizontalAlignment="Stretch"
                        Height="30"
                        Content="Reset"
                        Click="ResetClick"/>
            </StackPanel>
        </Border>
    </Grid>
</UserControl>


In this topic
  1. Code