V5 bug: Dashboard is not updated when the map style is changed programmatically
Hi,
In V5 we can set the dashboard to one of these three types: VEDashboardSize.Normal, VEDashboardSize.Small, VEDashboardSize.Tiny
Please check this reference for more details:http://msdn2.microsoft.com/en-us/library/bb412545.aspx
The bug is this: when thedashboard type is set toVEDashboardSize.Small, changing the map style from 'road', 'aerial' or 'hybrid' does not update the dashboard icon.
Sad but true. Here is the web page demonstrating this bug:
<
html><head>
<title>Dashboard icon not updated when changing the map style programmatically</title>
<metahttp-equiv="Content-Type"content="text/html; charset=utf-8"/>
<scriptsrc='http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=5'></script>
<scripttype="text/javascript">
var map =null;
var latitude = 47.67;
var longitude = -122.38;
var dashBoardSizes =new Array(VEDashboardSize.Normal, VEDashboardSize.Small, VEDashboardSize.Tiny) ;
var mapStyles =new Array(VEMapStyle.Road, VEMapStyle.Aerial, VEMapStyle.Hybrid) ;
var zoomLevel=6;
function GetMap()
{
map =new VEMap('myMap');
map.SetDashboardSize(dashBoardSizes[1] );
map.LoadMap(new VELatLong(latitude, longitude), zoomLevel ,'r' ,false,VEMapMode.Mode2D);
}
function OnLoadPage()
{
GetMap();
}
function OnUnloadPage()
{
DisposeMap();
}
function DisposeMap()
{
if (map !=null)//dispose the map
{
map.Dispose();
map=null;
}
}
function
radioRoad_onclick(){
ChangeMapStyle();
}
function
radioAerial_onclick(){
ChangeMapStyle();
}
function
radioHybrid_onclick(){
ChangeMapStyle();
}
function
ChangeMapStyle(){
for (var i = 0; i < radioMapStyle.length ; i++)
{
if (radioMapStyle
.checked)
{
map.SetMapStyle(mapStyles
);
}
}
}
</script>
</head>
<bodyonload="OnLoadPage();"onunload="OnUnloadPage();">
<inputid="radioRoad"style="z-index: 101; left: 64px; position: absolute; top: 496px"
type="radio"name="radioMapStyle"language="javascript"onclick="return radioRoad_onclick()"checked="CHECKED"/>
<divstyle="z-index: 108; left: 200px; width: 312px; position: absolute; top: 472px;
height: 100px">
<p>
When the<strong>dashboard type is set to small</strong>, changing the map style
between 'road', 'aerial' or 'hybrid' does<strong>not</strong> update the<spanstyle="text-decoration: underline">
dashboard icon</span>.</p>
</div>
<inputid="radioAerial"style="z-index: 102; left: 64px; position: absolute; top: 520px"
type="radio"name="radioMapStyle"language="javascript"onclick="return radioAerial_onclick()"/>
<inputid="radioHybrid"style="z-index: 103; left: 64px; position: absolute; top: 544px"
type="radio"name="radioMapStyle"language="javascript"onclick="return radioHybrid_onclick()"/>
<divid='myMap'style="position:relative; width:488px; height:400px; left: 8px; top: 16px; z-index: 100;">
</div>
<divstyle="z-index: 104; left: 88px; width: 100px; position: absolute; top: 496px;
height: 16px">
road</div>
<divstyle="z-index: 105; left: 88px; width: 100px; position: absolute; top: 544px;
height: 24px">
hybrid</div>
<divstyle="z-index: 106; left: 88px; width: 100px; position: absolute; top: 520px;
height: 24px">
aerial</div>
<divstyle="z-index: 107; left: 64px; width: 88px; position: absolute; top: 472px;
height: 1px; text-decoration: underline">
Map style</div>
</body>
</html>

