deal with  BingToken

506
2
06-27-2012 06:31 AM
AbdulrahmanTaher
New Contributor
Hello everyone.

I used Bing Map with the property bing token. but the map doesn't view.

private void MyMap_Loaded(object sender, RoutedEventArgs e)
        {
            foreach (Layer layer in MyMap.Layers)
                if (layer is TileLayer)
                    (layer as TileLayer).Token = (Application.Current as Silverlight_BingToken.App).BingToken;
        }


How can i define BingToken property in the code behind

<esri:Map Background="White" Name="MyMap"  Loaded="MyMap_Loaded">
            <esri:Map.Layers>
                <bing:TileLayer  ID="BingLayerLoad" LayerStyle="Road" ServerType="Production" Token="MyToken" />
            </esri:Map.Layers>
        </esri:Map>


Any advice?
0 Kudos
2 Replies
DominiqueBroux
Esri Frequent Contributor
The simplest way is to add the bing layer in the map by code after getting the token.
it's done that way in the bing samples.

The problem with the event Map.Loaded is that the layers are already on the way to initializating and the initialization fails if the token is wrong or not set.
0 Kudos
AbdulrahmanTaher
New Contributor
Thanks for your advice. you are right in the exception message , it said Bing Token is not set , so how can i set the key? Can you write the code please?

Another, yes i try to put the key in the layer and work fine . But i have problem with route service of bing , i customized the code to my application but route doesn't appear .

This my problem discuss if you can help me.

http://forums.arcgis.com/threads/60966-Problem-with-route-path-%28please-help%29?

Any Advice.
0 Kudos