Select to view content in your preferred language

How intellisense work in SL4 with arcgis

973
3
01-25-2012 01:53 AM
MuhammadWaqar_ul_islam
Occasional Contributor
How intellisense work in Silverlight 4 with arcgis data 
i want to used intellisense on text box
i have no idea how to use it in silverlight
need help
thanks in advanced
0 Kudos
3 Replies
DominiqueBroux
Esri Frequent Contributor
How intellisense work in Silverlight 4 with arcgis data


What do you mean by that?
0 Kudos
KenCarrier
Deactivated User
I think he means type ahead functionality similar to AJAX.

So when a user beings typing in a textbox it gives suggestions.

I am also interested in this.

Is there a way to make a textbox look at a particular field(s) within a FeatureServer service so that as the user begins typing the textbox will offer suggestions or AutoComplete.
0 Kudos
PaulLeedham
Deactivated User
I already shared this with Ken, but I thought that it might be helpful for the forum.  Personally, I think any search mechanism should use Auto Complete if possible.  Here is a simple example:
XAML:
<Grid x:Name="LayoutRoot" Background="White" >
       <sdk:AutoCompleteBox Height="28" HorizontalAlignment="Left" Margin="10,10,0,0" Name="AutoCompleteBox1" VerticalAlignment="Top" Width="120"/>
</Grid>

Code Behind:
Private Results As FeatureSet
Public ACList As New List(Of String)

    'Page loaded event or an event that fires the loading of the data
    Private Sub Page_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
        LoadData()
    End Sub

    Private Sub LoadData()
        Dim queryTask As New QueryTask("http://mcesapp/ArcGIS/rest/services/EditRelTbl/FeatureServer/1") 'These are examples from a previous post
        Dim query As New ESRI.ArcGIS.Client.Tasks.Query()
        query.Where = "1=1"
        query.OutFields.Add("*") ' You may just want to return the field to be used in the Auto Complete box
        queryTask.ExecuteAsync(query)

        AddHandler queryTask.ExecuteCompleted, AddressOf QueryTask_ExecuteCompleted
        AddHandler queryTask.Failed, AddressOf QueryTask_Failed
    End Sub


    Private Sub QueryTask_ExecuteCompleted(ByVal sender As Object, ByVal args As ESRI.ArcGIS.Client.Tasks.QueryEventArgs)
        Results = args.FeatureSet
        ACList.Clear()

        Dim ACValue As String
        For Each Feature As Graphic In Results
            ACValue = Feature.Attributes.Item("AC Field Name").ToString()
            ACList.Add(ACValue)
        Next
        AutoCompleteBox1.ItemsSource = ACList
    End Sub


Thats it!
0 Kudos