Select to view content in your preferred language

Silverlight Identify Help Needed

666
3
12-28-2010 07:44 AM
ElizabethMiller
Regular Contributor
I successfully created my first basic map in Silverlight. Now I am attempting to add the Identify from the samples at http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Identify. I have copied the code from the sample and inserted it in the appropriate places in my xaml and in my xaml.vb files. I have added the esri.arcgis.client reference. When I try to launch my map I get numerous errors. Is there something else required in order to use the samples? I have downloaded all the silverlight tools.

For starters, the first error I receive is for <Grid.Resources>. The message I receive when I hover over this code is "The attachable property 'Resources' was not found in type 'Grid.'"

Another error is this one: "The property 'Resources' does not exist on the type 'UserControl' in the XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'."

I have not done anything but attempt to copy the samples as they are provided by esri -- is there some trick to using the samples that I am missing?

Thanks to anyone who can help this newbie.

Liesa
0 Kudos
3 Replies
AliMirzabeigi
Emerging Contributor
Liesa,

Seems like you havn't defined the "Resources" in the right place. If you have resources defined for your UserControl then it should appear inside of your user control, i.e.:
<UserControl x:Class="....." 
   .....>
   <UserControl.Resources>
      .....
   </UserControl.Resources>
   <Grid x:name="...">
      .....
   </Grid>
</UserControl>

If the resources should be defined in the level of your Grid control then you should have something like the following:
<UserControl x:Class="....." 
   .....>
   <Grid x:name="...">
      <Grid.Resources>
         .....
      </Grid.Resources>
      .....
   </Grid>
</UserControl>
0 Kudos
ElizabethMiller
Regular Contributor
Thank you, Ali, that helped me clean up my structure!

A couple more problems that remain: I am getting errors for

Event handler 'QueryPoint_MouseClick' not found on class 'Liesa1.MainPage'
Event handler 'cb_SelectionChanged' not found on class 'Liesa1.MainPage'

Can you tell what I am missing to cause these errors?

Thanks again,
Liesa
0 Kudos
AliMirzabeigi
Emerging Contributor
You are missing the C# or VB code behind the XAML of your user control (MainPage). Simply look for those handlers, right-click on them and click on "Navigate to Event Handler" in the drop down menu. If you got the code from SDK samples and have the same functionality you could use the code available in "Code Behind C#" or "Code Behind VB" tabs on top of the frame showing the samples.
0 Kudos