Find

This sample demonstrates using the ArcGIS Runtime SDK for WPF to perform find operations on local data. To use the sample, specify a search string in the TextBox Control and click the Find Button. Click on rows in the DataGrid at the bottom of the application to see them in the map.

In the code-behind, the sample uses a FindTask to perform the find operation on local data. The task's find parameters specify to search specific layers and fields in the local data.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.LocalFind"
    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>
            <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
            <esri:SimpleMarkerSymbol x:Key="DefaultMarkerSymbol" Size="8" Color="Red" Style="Circle" />
            <esri:SimpleLineSymbol x:Key="DefaultLineSymbol" Color="Red" Width="6"  />
            <esri:SimpleFillSymbol x:Key="DefaultFillSymbol" BorderBrush="Red" BorderThickness="2" Fill="#50FF0000"/>
            <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>
        <Grid.RowDefinitions>
            <RowDefinition Height="35" />
            <RowDefinition Height="*" />
            <RowDefinition Height="150" />
        </Grid.RowDefinitions>

        <StackPanel Orientation="Horizontal" Background="{StaticResource PanelGradient}" HorizontalAlignment="stretch" VerticalAlignment="Top" Height="35" >
            <TextBlock Text="Search for" Foreground="White" 
                           HorizontalAlignment="Center" Height="24" VerticalAlignment="Center" 
                           FontWeight="Bold" FontSize="12" Margin="20,8,5,0"/>
            <TextBox x:Name="FindText" Background="White" Text="Colorado" Height="23" Width="100" HorizontalContentAlignment="Center" />
            <TextBlock Text="in the attributes of States or Cities:" Foreground="White" 
                           HorizontalAlignment="Center" Height="24" VerticalAlignment="Center" 
                           FontWeight="Bold" FontSize="12" Margin="5,8,5,0"/>
            <Button x:Name="ExecuteButton" Content="Find" Width="75" Height="24" VerticalAlignment="Center" Click="ExecuteButton_Click" IsEnabled="False"  
                        Margin="5,0,5,0" Cursor="Hand" />
        </StackPanel>

        <esri:Map x:Name="MyMap" MinimumResolution="2445.98490512499" WrapAround="True" Extent="-15000000,2000000,-7000000,8000000" Background="#FFE3E3E3" Grid.Row="1">
            <esri:ArcGISLocalTiledLayer ID="BaseMap" Path="..\\Data\\TPKs\\Topographic.tpk"/>
            <esri:ArcGISLocalDynamicMapServiceLayer Path="..\\Data\\MPKS\\USCitiesStates.mpk"/>
            <esri:GraphicsLayer ID="MyGraphicsLayer" />
        </esri:Map>
        <DataGrid x:Name="FindDetailsDataGrid" AutoGenerateColumns="False" HeadersVisibility="All" Background="White"
                         BorderBrush="Black" BorderThickness="1" SelectionChanged="FindDetails_SelectionChanged" 
                         HorizontalScrollBarVisibility="Hidden" Grid.Row="2"
                         IsReadOnly="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 
                         Height="Auto" Width="Auto">
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Path=LayerId}" Header="Layer ID" />
                <DataGridTextColumn Binding="{Binding Path=LayerName}" Header="Layer Name"/>
                <DataGridTextColumn Binding="{Binding Path=FoundFieldName}" Header="Found Field Name" />
                <DataGridTextColumn Binding="{Binding Path=Value}" Header="Found Field Value"/>
            </DataGrid.Columns>
        </DataGrid>
        <ProgressBar x:Name="MyProgressBar" IsIndeterminate="True" VerticalAlignment="Bottom" Width="200" Height="20" Margin="10" Visibility="{Binding Path=IsBusy, Converter={StaticResource BooleanToVisibilityConverter}}"></ProgressBar>
    </Grid>
</UserControl>

Sample code usage restrictions
5/16/2014