Select to view content in your preferred language

identify

1178
8
12-03-2010 08:51 AM
JayKappy
Frequent Contributor
I am trying to add the identify example to my app:
http://resources.esri.com/help/9.3/arcgisserver/apis/silverlight/samples/start.htm#Identify

I added the code to the MainPage.xaml and then added the vb code...
then made sure all the references were identifyied...

I change the code a bit to point to a new Layer
I then build and am gettign errors on the RED below

Error:
DataGridScrollViewer is not declared. It may be inaccessable due to its protection level.

I cant figure out whats going on here and where the error is coming from?
Any thoughts?



    Private Sub IdentifyTask_ExecuteCompleted(ByVal sender As Object, ByVal args As IdentifyEventArgs)
        IdentifyDetailsDataGrid.ItemsSource = Nothing

        If args.IdentifyResults IsNot Nothing AndAlso args.IdentifyResults.Count > 0 Then
            If DataGridScrollViewer.Visibility = Visibility.Collapsed Then
                DataGridScrollViewer.Visibility = Visibility.Visible
                IdentifyGrid.Height = Double.NaN
                IdentifyGrid.UpdateLayout()
            End If

            ShowFeatures(args.IdentifyResults)
        Else
            IdentifyComboBox.Items.Clear()
            IdentifyComboBox.UpdateLayout()

            If DataGridScrollViewer.Visibility = Visibility.Visible Then
                DataGridScrollViewer.Visibility = Visibility.Collapsed
                IdentifyGrid.Height = Double.NaN
                IdentifyGrid.UpdateLayout()
            End If
        End If
    End Sub
0 Kudos
8 Replies
JenniferNery
Esri Regular Contributor
The DataGridScrollViewer is declared in your XAML?

You have something like this?
<Grid x:Name="  DataGridScrollViewer" ...
0 Kudos
JayKappy
Frequent Contributor
Again this is STRIGHT from the ESRI example in the link above....This is what the example has for the xaml file.
I tried "IdentifyGrid" adn nothing....
I thought it would be a direct copy and paste besides the layer being targeted for the identify return results...


            <StackPanel Orientation="Vertical" Margin="10" HorizontalAlignment="Right" VerticalAlignment="Top" >
                <Grid x:Name="IdentifyGrid" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,7,7,0" >
                <Rectangle Fill="#CC5C90B2" Stroke="Gray"  RadiusX="10" RadiusY="10" Margin="0,0,0,5" >
                    <Rectangle.Effect>
                        <DropShadowEffect/>
                    </Rectangle.Effect>
                </Rectangle>
                <TextBlock x:Name="DataDisplayTitleTop" Text="Click on map to identify a feature" Foreground="Black" FontSize="10" 
                      Margin="10,5,0,0" />
                <TextBlock x:Name="DataDisplayTitleBottom" Text="Click on map to identify a feature" Foreground="White" FontSize="10" 
                      Margin="10,3,10,10" />
                <StackPanel x:Name="IdentifyResultsPanel" Orientation="Vertical" Margin="15" HorizontalAlignment="Center" 
                            VerticalAlignment="Top" Visibility="Collapsed" >
                    <ComboBox x:Name="IdentifyComboBox" MinWidth="150" SelectionChanged="cb_SelectionChanged"
                         Margin="5,10,5,5" >
                    </ComboBox>
                    <ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Auto"  
                         Width="230" MaxHeight="340">
                        <slData:DataGrid x:Name="IdentifyDetailsDataGrid" AutoGenerateColumns="False" HeadersVisibility="None" 
                              Background="White">
                            <slData:DataGrid.Columns>
                                <slData:DataGridTextColumn Width="95" Binding="{Binding Path=Key}" FontWeight="Bold"/>
                                <slData:DataGridTextColumn Width="115" Binding="{Binding Path=Value}"/>
                            </slData:DataGrid.Columns>
                        </slData:DataGrid>
                    </ScrollViewer>
                </StackPanel>
            </Grid>
            </StackPanel>
0 Kudos
JenniferNery
Esri Regular Contributor
In your code-behind you have "DataGridScrollViewer", but your XAML does not declare this object.

I think you meant to rename "IdentifyResultsPanel". If you have renamed this in code-behind, you have to rename it in your XAML too.
0 Kudos
JayKappy
Frequent Contributor
That seemed to work.....I dont know why it is different than the code exmaple on ESRI website?
0 Kudos
JayKappy
Frequent Contributor
In your code-behind you have "DataGridScrollViewer", but your XAML does not declare this object.

I think you meant to rename "IdentifyResultsPanel". If you have renamed this in code-behind, you have to rename it in your XAML too.


I didnt rename anything....I copied this right from the ESRI example from their website....
0 Kudos
JenniferNery
Esri Regular Contributor
From this sample? http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Identify

VB code has this:
  Private Sub IdentifyTask_ExecuteCompleted(ByVal sender As Object, ByVal args As IdentifyEventArgs)
   IdentifyDetailsDataGrid.ItemsSource = Nothing

   If args.IdentifyResults IsNot Nothing AndAlso args.IdentifyResults.Count > 0 Then
    IdentifyResultsPanel.Visibility = Visibility.Visible

    ShowFeatures(args.IdentifyResults)
   Else
    IdentifyComboBox.Items.Clear()
    IdentifyComboBox.UpdateLayout()

    IdentifyResultsPanel.Visibility = Visibility.Collapsed
   End If
  End Sub


The code you posted changes Visibility of a different object ("DataGridScrollViewer"). I'm not sure where you copy that from.
0 Kudos
JayKappy
Frequent Contributor
I pasted this in my first entry

I am trying to add the identify example to my app:
http://resources.esri.com/help/9.3/a...t.htm#Identify

I grabbed this example....there is something wrong with it...or am just missing something.  I will refer to the green page you showed me....

Question:  I have to identify working on one layer....I created a section (another row definition to seperate it from the map) on the bottom of my page that houses the box that returns the values...so its not on my map.....
I now want to do a click and basically run that identify on multiple layers returning results into multiple windows which I can show in this seperate Row Definition...
Can this be done with the identify or do I need to focus soemwhere else...
similar to the government example on this ESRI page (ON PAGE 2..the Governenet Service Locator)
http://help.arcgis.com/en/webapi/silverlight/gallery.html

I thank you for your help....very appreciated...

Hope you can answer my last question above or at least guide me in the correct direction....I tried to duplicate the idenifty code used but it seems that its only running once....I tried to return the same results to another window next to the workign one....nothing comes back....


thanks again
0 Kudos
JayKappy
Frequent Contributor
ACTUALLY I think I just got it working....I am targeting the same layer but think thats an easy fix....I do greatly appreciate your help....got me in the right direction...
0 Kudos