Find Online

This sample demonstrates performing find operations. 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. The task's find parameters specify to search specific fields in the states and counties layers.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.Find"
    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="#FF5C90B2">

        <Grid.Resources>
            <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>

        <Border BorderBrush="Black" BorderThickness="1">
            <StackPanel Orientation="Horizontal" Background="{StaticResource PanelGradient}" Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Top" >
                <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, Rivers, 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"  
                        Margin="5,0,5,0" Cursor="Hand" />
            </StackPanel>
        </Border>

        <esri:Map x:Name="MyMap" Grid.Row="1"  WrapAround="True" Extent="-15000000,2000000,-7000000,8000000">
            <esri:ArcGISTiledMapServiceLayer ID="TopoLayer" 
                    Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
            <esri:ArcGISDynamicMapServiceLayer ID="DemographicLayer"
                     Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer" />
            <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>

    </Grid>
</UserControl>

Sample code usage restrictions
5/16/2014