Select to view content in your preferred language

Load Bing Basemap on button click

627
2
09-08-2011 10:07 AM
NigelAlford
Occasional Contributor
I have the Bing base map set to Aerial, I have created the corresponding buttons "Aerial", "Road", and "Hybrid". I want to select the appropriate layer per user click, so far nothing happens and the Bing SDK only uses "Map Mode" which isn't recognized. Dev environment: Expression Blend 4, VS 2010 all uptodate.
.xaml:
<esri:Map x:Name="MyMap" IsLogoVisible="False" Margin="0,32,0,-32" Extent="-13887825.123,2444748.272,-7773660.946,6480218.546">
<esri:Map.Foreground>
<SolidColorBrush Color="Black"/>
</esri:Map.Foreground>
<bing:TileLayer ID="BingLayer" LayerStyle="Aerial" ServerType="Production"
Token="{StaticResource BingKeyString}" />
<esri:ArcGISDynamicMapServiceLayer ID="AllNSLayers"
Url="http://gatucitvgis05s/ArcGISCache/rest/services/NSRail_MilePost/MapServer"/>
</esri:Map>

c#:
private void Roads_Button_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
ESRI.ArcGIS.Client.Bing.TileLayer tileLayer = MyMap.Layers["BingLayer"] as TileLayer;
string layerTypeTag= "Road";
TileLayer.LayerType newLayerType = (TileLayer.LayerType)System.Enum.Parse(typeof(TileLayer.LayerType), layerTypeTag, true);
tileLayer.LayerStyle = newLayerType;

Any help would be appreciated...
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
Are you using this SDK sample? http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#BingImagery Notice that each RadioButton in XAML were assigned a Tag that corresponds to LayerType. When debugging, try to see if you are getting the correct layer type as you switch between styles.
0 Kudos
NigelAlford
Occasional Contributor
Thanks, that was the push I needed. I wasn't using the correct object type, and I had to give it a tag.
If anyone runs into this problem pm me and I can help
0 Kudos