Unable to change the pushpin iconstyle
-
Saturday, March 05, 2011 3:21 PM
Hi all,
I have an event called MyMap_MouseClick executed when my map is clicked.
I have the following codes:
void MyMap_MouseClick(object sender, MapMouseEventArgs e)
{
// Convert the point to a Location.
Location location = MyMap.Mode.ViewportPointToLocation(e.ViewportPoint);
// Create a pushpin.
Pushpin pin = new Pushpin();
pin.Location = location;
pin.Name = pin.Location.Latitude + ", " + pin.Location.Longitude;
pin.IconStyle = "25"; <--Error
// Add the pushpin to the map.
CommentsLayer.Children.Add(pin);
}I am having error with the statement:
pin.IconStyle = "25";
Am i missing any assembly?as far as I know IconStyle is included in the Pushpin class isn't it?
However I am unable to set the IconStyle property of my pushpins.
Any Help would be greatly appreciated.
Best Regards.
- Moved by Richard_BrundrittMicrosoft Employee, Owner Friday, March 16, 2012 6:44 PM (From:Bing Maps: Map Control and Web services Development)
All Replies
-
Saturday, March 05, 2011 4:16 PMModeratorsorry just checking is this a silverlight or wp7 question?
Brian @ Earthware - UK interactive mapping web developers http://www.earthware.co.uk/blog | http://www.twitter.com/earthware | Windows Live Developer MVP -
Saturday, March 05, 2011 4:57 PM
This is a silverlight question.
Thank you.
-
Saturday, March 05, 2011 6:34 PMModerator
then looking at the api reference:
http://msdn.microsoft.com/en-us/library/microsoft.maps.mapcontrol.pushpin_members.aspx
There is no property on the pushpin for IconStyle. As far as Im aware the only api IconStyle works with is the static imagery service
Brian @ Earthware - UK interactive mapping web developers http://www.earthware.co.uk/blog | http://www.twitter.com/earthware | Windows Live Developer MVP- Marked As Answer by Richard_BrundrittMicrosoft Employee, Owner Monday, February 27, 2012 11:21 AM
-
Sunday, March 06, 2011 1:20 AM
then looking at the api reference:
http://msdn.microsoft.com/en-us/library/microsoft.maps.mapcontrol.pushpin_members.aspx
There is no property on the pushpin for IconStyle. As far as Im aware the only api IconStyle works with is the static imagery service
Brian @ Earthware - UK interactive mapping web developers http://www.earthware.co.uk/blog | http://www.twitter.com/earthware | Windows Live Developer MVPHi Brian,thanks for the reply.
Yes you are correct,the IconStyle works with the imagery service.
I read this article that's why I was confussed.
http://207.46.16.248/en-us/library/cc981128.aspx
http://msdn.microsoft.com/en-us/library/ff701719.aspx
Is there any other approach that I can take to customize the style of my pushpins without using the imagery service?
Sorry I am new to Bing Maps API.
Thank you very much.
-
Sunday, March 06, 2011 3:33 AM
Problem solved.
Thanks
- Marked As Answer by NanoBite Sunday, March 06, 2011 3:33 AM
- Unmarked As Answer by Richard_BrundrittMicrosoft Employee, Owner Monday, February 27, 2012 11:20 AM
-
Sunday, February 26, 2012 11:15 PMI would like to change the shapes of my pushpin. How did you solve this?
-
Monday, February 27, 2012 11:23 AMOwner
Take a look at this article: http://rbrundritt.wordpress.com/2010/05/02/custom-pushpins-in-bing-maps-silverlight/
You can also create great pushpins using UserControls. Any kind of UserControl can be added to the map.
http://rbrundritt.wordpress.com
- Marked As Answer by Richard_BrundrittMicrosoft Employee, Owner Monday, February 27, 2012 11:23 AM

