Select to view content in your preferred language

display all records

1732
3
12-23-2010 09:25 AM
JayKappy
Frequent Contributor
I have an app that displays a results window with information about a feature using the identify tool...This is working fine.
But I know what the create one more return window based off of another feature BUT this time simply show all the records (8 records, schools) in the results window...
this is going to be a point layer and not identified on when the user clicks the map, but want to force the identify....
I am using the identify example from ESRI API SIlverlight.  This example shows how to return the results to a window from a user click.  IF there are multiple returns then it populates a combobox with the results allowing the user to select and change the values on the window.

I was wondering how to automate it to simply show all the records on a user click on the map

I am half way there because I can display the record I select...BUT I want the users click (which wont click on the feature) that identifys existing features....to force the identify on thsi other feature

Would I use a buffer for this?
Is there some way to automate it to simply select all?

How do I loop through and display multiple records in the results window?  I can see how this is being done for the combobox but cannot think of how to do this from VB adn loop it through the xaml file to show multiple results?

Does that make any sense...PLEASE SEE ATTACHEMENT

If I can get this to work it will be eliminating the Combobox...so that is no worry...

Thanks

DEFINED GRID WITH FORMAT:
                <Grid Grid.Column="1" >
                    <StackPanel Orientation="Vertical" Margin="5" HorizontalAlignment="left" VerticalAlignment="top" >
                        <Grid x:Name="IdentifyGrid2" HorizontalAlignment="left" VerticalAlignment="Top" Margin="0,7,7,0" >
                            <Rectangle Stroke="Gray" RadiusX="10" RadiusY="10" Margin="0,0,0,5" >
                                <Rectangle.Effect>
                                    <DropShadowEffect/>
                                </Rectangle.Effect>
                            </Rectangle>
                            <TextBlock x:Name="DataDisplayTitleTop2" Text="Click on map to identify a feature" Foreground="Black" FontSize="10" 
                                      Margin="10,5,0,0" />
                            <TextBlock x:Name="DataDisplayTitleBottom2" Text="Click on map to identify a feature" Foreground="White" FontSize="10" 
                                      Margin="10,3,10,10" />
                            <StackPanel x:Name="IdentifyResultsPanel2" Height="180" Width="190" Orientation="Vertical" Margin="15" HorizontalAlignment="Center" 
                                            VerticalAlignment="Top" Visibility="Collapsed" >
                                <ComboBox x:Name="IdentifyComboBox2" MinWidth="150" SelectionChanged="cb_SelectionChanged2"
                                         Margin="5,10,5,5" >
                                </ComboBox>
                                <Grid x:Name="IdentifyDetailsDataGrid2">
                                    <StackPanel Orientation="Vertical">
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Foreground="White" Text="Day:  " /> 
                                            <TextBlock Foreground="White" Text="{Binding [Day]}" />
                                        </StackPanel>
                                    </StackPanel>
                                </Grid>
                            </StackPanel>
                        </Grid>
                    </StackPanel>
                </Grid>



VB CODE:
        Dim identifyParamsParcelsPrecinct As ESRI.ArcGIS.Client.Tasks.IdentifyParameters = New IdentifyParameters() With {.Geometry = clickPoint, .MapExtent = MyMap.Extent, .SpatialReference = MyMap.SpatialReference, .Width = CInt(Fix(MyMap.ActualWidth)), .Height = CInt(Fix(MyMap.ActualHeight)), .LayerOption = LayerOption.visible}
        ' Set the layer to identify on
        identifyParamsParcelsPrecinct.LayerIds.Add(2)
        Dim identifyTask2 As New IdentifyTask("http://gis.logis.org/arcgis/rest/services/MG_Test/MapServer")
        AddHandler identifyTask2.ExecuteCompleted, AddressOf IdentifyTask2_ExecuteCompleted
        AddHandler identifyTask2.Failed, AddressOf IdentifyTask2_Failed
        identifyTask2.ExecuteAsync(identifyParamsParcelsPrecinct)

    ' SECOND BOX
    Public Sub ShowFeatures2(ByVal results As List(Of IdentifyResult))
        _dataItems2 = New List(Of DataItem2)()

        If results IsNot Nothing AndAlso results.Count > 0 Then
            IdentifyComboBox2.Items.Clear()
            For Each result As IdentifyResult In results
                Dim feature As Graphic = result.Feature
                Dim title As String = result.Value.ToString() & " (" & result.LayerName & ")"
                _dataItems2.Add(New DataItem2() With {.Title = title, .Data2 = feature.Attributes})

                IdentifyComboBox2.Items.Add(title)
            Next result

            ' Workaround for bug with ComboBox 
            IdentifyComboBox2.UpdateLayout()
            IdentifyComboBox2.SelectedIndex = 0
        End If
    End Sub
    Private Sub cb_SelectionChanged2(ByVal sender As Object, ByVal e As SelectionChangedEventArgs)
        Dim index As Integer = IdentifyComboBox2.SelectedIndex
        If index > -1 Then
            IdentifyDetailsDataGrid2.DataContext = _dataItems2(index).Data2
        End If
    End Sub
0 Kudos
3 Replies
JayKappy
Frequent Contributor
DO I have to add some sort of a Scroll Viewer?
DO something in the For Each Next? I tired to set the Data Content in this area and nothing happens..

I am trying to get the index of the record in the For Ech Next loop then set the data context to that Index...but cant figure that out...The combobox on change does this by setting the index and updating the dataContext but cant figure out how to do it without the combobox...

Tryign to get soemthing like this:

Record 1
info, info, info
-------------------
Record 2
info, info, info
-------------------
Record 3
info, info, info
-------------------


    Public Sub ShowFeatures5(ByVal results As List(Of IdentifyResult))
        _dataItems5 = New List(Of DataItem5)()

        If results IsNot Nothing AndAlso results.Count > 0 Then
            IdentifyComboBox5.Items.Clear()
            For Each result As IdentifyResult In results
                Dim feature As Graphic = result.Feature
                Dim title As String = result.Value.ToString() & " (" & result.LayerName & ")"
                _dataItems5.Add(New DataItem5() With {.Title = title, .Data5 = feature.Attributes})
                IdentifyComboBox5.Items.Add(title)

                ' I tried to hard code this to an index but got nothing...
                IdentifyDetailsDataGrid5.DataContext = _dataItems5(2).Data5
            Next result

            ' Workaround for bug with ComboBox 
            IdentifyComboBox5.UpdateLayout()
            IdentifyComboBox5.SelectedIndex = 0

        End If
    End Sub
    Private Sub cb_SelectionChanged5(ByVal sender As Object, ByVal e As SelectionChangedEventArgs)
        Dim index As Integer = IdentifyComboBox5.SelectedIndex
        If index > -1 Then
            IdentifyDetailsDataGrid5.DataContext = _dataItems5(index).Data5
        End If    
End Sub
0 Kudos
JayKappy
Frequent Contributor
I tried to add a scroll viewer but that didnt work....I think that I need to move back towards a Data column but I want to specify how it looks, not just throw all the attributes in there....

Again I am looking to return values as in my last entry...in that format...

I cant figure this out...dont even know where to look...I can add teh scroll Viewer but it still only returns teh first record....
Thinking that I have to do soemthign in the For Each loop???

<ScrollViewer VerticalScrollBarVisibility="Auto"  Width="200" MaxHeight="150" HorizontalScrollBarVisibility="Hidden" >                                 

<!--...Code from last entry-->

</ScrollViewer>  


Any more ideas....your help is greatly apprecaited...
0 Kudos
JayKappy
Frequent Contributor
Getting back to what I am looking for....I got a littel side tracked...when the user selects on map I want to do the identify as usual but return all the values automatically...so the click on the map just fires the code off, the identify returns all values...
Then I want to show all returned records with just a few field attrobutes showing (Not all).

Say for instance I have Police Stations.  When the user clicks the screen data is retuireved on Parcels, adn other layers, BUT I want to return all the police stations in that layer and siaply them on the map automatically.  And have relivant information in the ideditify window...
IN the future I want to be able to scroll over the returned values and highlight the feature in the map.

Does that make sense?  Anyone have any ideas

I assume that I can set the Tolerance on the Identify Params to soemthign high so it will grab all of them.  So Now I just need to figure out how to cycle through all the values and show them...RIGHT NOW it only shows the first returned value....HOW do I cycle through and return them all in the DataContext??????

Maybe do I need to add column Definitions (Vertical?) in my xaml ????

THanks
0 Kudos