Yaaa Hoooo!!!!!Jennifer and others....thank you very much for the start...it was a great help...I was able to get your example working and then modifed to return the results from my query...I created a little TOC on the left of my map that opens when the query is run and displays the relivant data. Thanks again for your help and patience....If anyone has any further questions or wants more info on what I am doing please feel free to contact me...jaykappy@yahoo.comI now look forward to tweakign the queries to retun other relivant data...THANKS Jennifer...very apprecaited..VB Code Private Sub ExecutePIDButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
' OPEN THE RESULTS PANEL TO DISPLY RESULTS
ShowResultsPanel.Begin()
Dim queryTaskPolice As New QueryTask("http://gis.somewhere.org/MapServer/0")
AddHandler queryTaskPolice.ExecuteCompleted, AddressOf QueryTaskPolice_ExecuteCompletedListBox
AddHandler queryTaskPolice.Failed, AddressOf QueryTaskPolice_FailedSearchListBox
Dim queryPolice As New ESRI.ArcGIS.Client.Tasks.Query()
queryPolice.OutFields.Add("Officer, Incident, IncidentNum")
queryPolice.ReturnGeometry = True
' Return all features
queryPolice.Where = "1=1"
queryPolice.OutSpatialReference = MyMap.SpatialReference
queryTaskPolice.ExecuteAsync(queryPolice)
End Sub
Private Sub QueryTaskPolice_ExecuteCompletedListBox(ByVal sender As Object, ByVal args As ESRI.ArcGIS.Client.Tasks.QueryEventArgs)
Dim featureSet As FeatureSet = args.FeatureSet
' WORK WITH THE RESULTS FROM THE QUERY FOR INCIDENTS
' Create a list by Incident and then talley the number of each
Dim results = From g In featureSet
Group g By GroupKey = CStr(g.Attributes("Incident")) Into r = Group
Select New With {Key .Incident = GroupKey, Key .IncidentNums = r.Sum(Function(i) Convert.ToInt32(i.Attributes("IncidentNum")))}
Me.Results.ItemsSource = results
End Sub
<StackPanel x:Name="IdentifyResultsPanelBufferIncidents_Police" Height="300" Width="175" Orientation="Vertical" Margin="0,0,0,0" HorizontalAlignment="Center">
<Grid x:Name="resultsPanelBufferIncidents_Police" Width="175" Height="300"
HorizontalAlignment="Center" VerticalAlignment="Top"
Margin="0,0,0,0">
<StackPanel Orientation="Vertical">
<StackPanel>
<Button Content="calculate total" VerticalAlignment="Top" HorizontalAlignment="Center" Click="Button_Click"/>
<ListBox x:Name="Results">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Incident, StringFormat='Type: \{0\}'}" Grid.Column="0"/>
<TextBlock Text=" has " Foreground="Black" Grid.Column="1" />
<TextBlock Text="{Binding IncidentNums}" Grid.Column="2"/>
<TextBlock Text=" incident" Foreground="Black" Grid.Column="3"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</StackPanel>
</Grid>
</StackPanel>