Select to view content in your preferred language

Magnifying Glass with a Bing TileLayer

519
2
11-04-2011 09:27 AM
HugoCardenas
Emerging Contributor
Has anyone gotten to work the Magnifying Glass with an ESRI.ArcGIS.Client.Bing.TileLayer?

My base map is a ESRI.ArcGIS.Client.Bing.TileLayer and I would like to use the Magnifying Glass on it.  The Magnifying Glass is blank (dark) and displays nothing.  If I use an "ArcGISTiledMapServiceLayer" it works fine with the URL property set.

Since I use an ESRI.ArcGIS.Client.Bing.TileLayer I do not have a URL property, but a Bing Map key and TileLayer properties.

I have tried to cast the ESRI.ArcGIS.Client.Bing.TileLayer into an ArcGISTiledMapServiceLayer, but  the Magnifying Glass remains blank.

Casting code:
if (MagnifyingGlass != null) MagnifyingGlass.Layer = MyMap.Layers[0] as ArcGISTiledMapServiceLayer;


Any ideas?
Hugo.
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
Have you looked at this SDK sample: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#MagnifyingGlass

MagnifyingGlass need a different instance of TiledMapServiceLayer. Layers already associated to another map will throw an exception.

        <esri:MagnifyingGlass x:Name="MyMagnifyingGlass" Visibility="Visible" ZoomFactor="3"
                              Map="{Binding ElementName=MyMap}" >
            <esri:MagnifyingGlass.Layer>
                <bing:TileLayer ID="BingLayer" LayerStyle="AerialWithLabels" ServerType="Production"
                            Token="{StaticResource BingToken}"/>
            </esri:MagnifyingGlass.Layer>
        </esri:MagnifyingGlass>


or in code-behind:
 MyMagnifyingGlass.Layer = new ESRI.ArcGIS.Client.Bing.TileLayer()
            {
                ID = "BingLayer",
                LayerStyle = ESRI.ArcGIS.Client.Bing.TileLayer.LayerType.AerialWithLabels,
                ServerType = ESRI.ArcGIS.Client.Bing.ServerType.Production,
                Token = this.LayoutRoot.Resources["BingToken"] as string
            };
0 Kudos
HugoCardenas
Emerging Contributor
Thanks Jennifer!
It works great now.  Your code-behind (C#) sample made it possible.
 
I add the Bing.TileLayer at run-time, rather than using XAML to prevent Visual Studio 2010 crashes during design.  (Visual Studio 2010 crashes if the Bing Maps token is placed in XAML; hence, I load the TileLayer at run-time.)

Hugo.
0 Kudos