Add In Bookmark Example.

3515
12
04-25-2012 10:15 AM
deleted-user-yA_w_FC9FKe5
New Contributor III
So I want to try and use the bookmarks add-in.  I downloaded the sample and then tried to add it into my page using the settings/add-ins but that did not seem to work.  So I saw something about having to compile or something.  So I opened it up in VS 2010 and noticed right away I had some reference errors with the esri assemblies.  So I just added those in using the Project/Add Reference/Browse (ex C:\Program Files (x86)\ESRI SDKs\Silverlight\v2.4\ESRI.ArcGIS.Client.Toolkit.dll).

Now I get one on system.windows.interactivity.  I tried to add it like the others but it was not located in the ("C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\") like System.Windows.Browser.dll was.  I did a search for that dll and found it (Expressions) and placed it in the folder but VS 2010 does not like it because I moved it.   So then I took it out thinking I might not need it and now get a bunch of errors.

So what all am I doing wrong here.  Obviously I am a newbie at this.
0 Kudos
12 Replies
KatherineDalton
Esri Regular Contributor
Yes, you need the System.Windows.Interactivity dll, but you can leave it in it's original folder and just Browse to that folder when adding the reference. I believe the default location is: C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\Silverlight\v4.0\Libraries (or similar).

For the Bookmark sample, I've actually uploaded the .xap file (add-in) to ArcGIS Online, so you can download it directly without having to compile it:
http://www.arcgis.com/home/item.html?id=3a6423933da3417886e39f37a2832ae9

Katy
Katy Dalton | Technical Consultant
THE SCIENCE OF WHERE™
0 Kudos
deleted-user-yA_w_FC9FKe5
New Contributor III
Yes, you need the System.Windows.Interactivity dll, but you can leave it in it's original folder and just Browse to that folder when adding the reference. I believe the default location is: C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\Silverlight\v4.0\Libraries (or similar).

For the Bookmark sample, I've actually uploaded the .xap file (add-in) to ArcGIS Online, so you can download it directly without having to compile it:
http://www.arcgis.com/home/item.html?id=3a6423933da3417886e39f37a2832ae9

Katy


Nice but I would still like to be able to edit this add-in.  Once I have this running in Visual Studio will I be to add the bookmarks I want to the widget via code.  This is what I really want to do.  I need to be able to send users to different districts using bookmarks/dropdown whatever with a name and then the Web Mercator coordinate system information.


As for Visual Studio and the System.Windows.Interactivity dll.  The only one I find  gives me an error that it does not belong with silverlight.  Please see screen shot below.  Thanks for all of your help.  This is very exciting.


[ATTACH=CONFIG]13829[/ATTACH]
0 Kudos
deleted-user-yA_w_FC9FKe5
New Contributor III
So I found this code in tools.xml

            <Bookmark.MapBookmark>
              <Extent xmlns:d3p1="http://schemas.datacontract.org/2004/07/ESRI.ArcGIS.Client.Geometry">
                <d3p1:spatialReference>
                  <d3p1:wkid>102100</d3p1:wkid>
                </d3p1:spatialReference>
                <d3p1:xmax>-13045320.775415432</d3p1:xmax>
                <d3p1:xmin>-13047143.032605518</d3p1:xmin>
                <d3p1:ymax>4036870.6724080243</d3p1:ymax>
                <d3p1:ymin>4036096.2954827617</d3p1:ymin>
              </Extent>
              <Name>Esri</Name>
            </Bookmark.MapBookmark>

And tried adding in my own creating the code from ArcGIS Desktop.  Will this work once we solve my reference issue.  What is "http://schemas.datacontract.org/2004/07/ESRI.ArcGIS.Client.Geometry"

           <Bookmark.MapBookmark>
              <Extent xmlns:d3p1="http://schemas.datacontract.org/2004/07/ESRI.ArcGIS.Client.Geometry">
                <d3p1:spatialReference>
                  <d3p1:wkid>102100</d3p1:wkid>
                </d3p1:spatialReference>
                <d3p1:xmax>-12924841.7103843</d3p1:xmax>
                <d3p1:xmin>-13687125.6273765</d3p1:xmin>
                <d3p1:ymax>6062311.60890295</d3p1:ymax>
                <d3p1:ymin>5402975.31369014</d3p1:ymin>
              </Extent>
              <Name>Portland</Name>
            </Bookmark.MapBookmark>
0 Kudos
KatherineDalton
Esri Regular Contributor
Hi Michael,

It sounds like maybe you need to install the Expression" rel="nofollow" target="_blank">http://www.microsoft.com/download/en/details.aspx?display... Blend SDK to get the proper dll. Do you have that installed already?

Katy
Katy Dalton | Technical Consultant
THE SCIENCE OF WHERE™
0 Kudos
deleted-user-yA_w_FC9FKe5
New Contributor III

[/HR]
Hi Michael,

It sounds like maybe you need to install the Expression Blend SDK to get the proper dll. Do you have that installed already?

Katy


I feels like one foot forward and two steps behind at the current moment.  So I got it to compile without any errors however when I go to upload it I get this error now with application builder.   Were getting closer.  I'm getting an error after this that says value does not fall within acceptable range:

at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
   at MS.Internal.XcpImports.MethodPack(IntPtr objectPtr, String methodName, Object[] rawData)
   at MS.Internal.XcpImports.Collection_Add(PresentationFrameworkCollection`1 collection, Object value)
   at System.Windows.PresentationFrameworkCollection`1.AddImpl(Object value)
   at System.Windows.Controls.ItemCollection.AddImpl(Object value)
   at System.Windows.Controls.ItemCollection.AddInternal(Object value)
   at ESRI.ArcGIS.Mapping.Builder.Controls.AvailableToolbarItemsControl.buildAddItemTree()
   at ESRI.ArcGIS.Mapping.Builder.MainPage.Settings_ExtensionsCatalogChanged(Object sender, EventArgs e)
   at ESRI.ArcGIS.Mapping.Builder.Settings.ExtensionsCatalog_Changed(Object sender, EventArgs e)
   at ESRI.ArcGIS.Mapping.Builder.ExtensionsManager.OnExtensionsCatalogChanged(EventArgs args)
   at ESRI.ArcGIS.Mapping.Builder.ExtensionsManager.extensionsProvider_LoadAdditionalExtensionCompleted(Object sender, EventArgs e)
   at ESRI.ArcGIS.Mapping.Core.ExtensionsManager.<>c__DisplayClass8.<LoadAdditionalExtension>b__6(Object s, OpenReadCompletedEventArgs e)
   at System.Net.WebClient.OnOpenReadCompleted(OpenReadCompletedEventArgs e)
   at System.Net.WebClient.OpenReadOperationCompleted(Object arg)


[ATTACH=CONFIG]13841[/ATTACH]
0 Kudos
deleted-user-yA_w_FC9FKe5
New Contributor III
Ha I think I have it working but how can I edit it so that I can put in my own generic zooms.

So I found this code in tools.xml

<Bookmark.MapBookmark>
<Extent xmlns:d3p1="http://schemas.datacontract.org/2004/07/ESRI.ArcGIS.Client.Geometry">
<d3p1:spatialReference>
<d3p1:wkid>102100</d3p1:wkid>
</d3p1:spatialReference>
<d3p1:xmax>-13045320.775415432</d3p1:xmax>
<d3p1:xmin>-13047143.032605518</d3p1:xmin>
<d3p1:ymax>4036870.6724080243</d3p1:ymax>
<d3p1:ymin>4036096.2954827617</d3p1:ymin>
</Extent>
<Name>Esri</Name>
</Bookmark.MapBookmark>

I tried adding in my own creating the code from ArcGIS Desktop. Will this work once we solve my reference issue. What is "http://schemas.datacontract.org/2004/07/ESRI.ArcGIS.Client.Geometry"

<Bookmark.MapBookmark>
<Extent xmlns:d3p1="http://schemas.datacontract.org/2004/07/ESRI.ArcGIS.Client.Geometry">
<d3p1:spatialReference>
<d3p1:wkid>102100</d3p1:wkid>
</d3p1:spatialReference>
<d3p1:xmax>-12924841.7103843</d3p1:xmax>
<d3p1:xmin>-13687125.6273765</d3p1:xmin>
<d3p1:ymax>6062311.60890295</d3p1:ymax>
<d3p1:ymin>5402975.31369014</d3p1:ymin>
</Extent>
<Name>Portland</Name>
</Bookmark.MapBookmark>
0 Kudos
KatherineDalton
Esri Regular Contributor
Hi Michael,

The initial warning messages you see are simply warnings. To remove this warning, return to your Visual Studio solution and make sure that Copy Local=False for the references specified in the dialog box.

I'm not sure about the second error you are receiving. Can you try including the add-in in its default state (that is, without any edits to the Tools.xml file).

Also, for the "http://schemas.datacontract.org/2004/07/ESRI.ArcGIS.Client.Geometry", see http://msdn.microsoft.com/en-us/library/ms731045.aspx.

Katy
Katy Dalton | Technical Consultant
THE SCIENCE OF WHERE™
0 Kudos
deleted-user-yA_w_FC9FKe5
New Contributor III
Hey Katie:

Thanks for the reply.  I've gotten the bookmarks example to work thanks to your help.  What I am trying to do now is to be able to have some default bookmarks added for the user.  We have 70 districts and I have the needed information in webmercator to have them zoom to these areas.  I saw in the tools.xml you guys look like you have some default locations already.  I'm just not sure how to get my bookmarks to see these.  I don't understand why we have a .web and .addins as part of the solutions.  Should I be using something else besides the .addins xap file?  I would be estatic if you could help me get these district locations into the bookmarks.  I can create whatever code is need from my side. 

Michael
0 Kudos
KatherineDalton
Esri Regular Contributor
Hi Michael,

From our help:" rel="nofollow" target="_blank">http://help.arcgis.com/en/webapps/silverlightviewer/help/index.html#/Visual_Studio_template/01770000000w000000/]help[/url]:

Visual Studio solutions created from the Viewer template will include three projects. In the list below, <Project Name> means the name of the project as specified on the New Project dialog box. The projects created as part of the template are as follows:
�?�<Project Name>�??This is a website project containing a fully functional Viewer application. This contains a copy of all the configuration files that are included with the Viewer. When you compile the solution, the output from the AddIns project and the layouts in the Layouts project are automatically copied to this website.
�?�<Project Name>.AddIns�??Contains a simple tool and behavior to get you started writing your own add-in. See Creating" rel="nofollow" target="_blank">http://help.arcgis.com/en/webapps/silverlightviewer/help/in... a Tool and Creating a Behavior for further details.
�?�<Project Name>.Layouts�??Contains a copy of the default layouts that are deployed with the Viewer. You can open these in Visual Studio or Expression Blend to modify their design or create new layouts.

You won't be able to edit the Tools.xml file directly to add the bookmarks; instead, you'll need to write some code on your end to allow entering of coordinates. (Enter coordinates, zoom to location, create bookmark, etc.). 🙂

Katy
Katy Dalton | Technical Consultant
THE SCIENCE OF WHERE™
0 Kudos