Put my own images on PushpinInfo

May 13, 2009 at 2:12 PM

Hi!

I'm trying to put my own images into my PushpinGeometry, but I can't put my image in PushpinInfo, because the Image property is BitmapProvider and the Image.CurrentImage is read only. Do you know any way to put my own image in my PushpinGeometry?

Thanks!

Coordinator
May 13, 2009 at 2:33 PM

Are you using InfoStrat.VE or just Virtual Earth?  InfoStrat.VE provides it's own pushpin technique where you don't have to do anything with PushpinGeometry or layers or anything.  Take a look at the sample application.

 

May 13, 2009 at 2:59 PM

I am doing an application to put pushpins, polygons and polylines in virtual earth. I am doing my own Pushpin class to put pushpins in the map becouse I need my own class structure. I was working with google maps, and in google maps I put my pushpins using marker and  marker_options. There are any way to use pushpins in the same way?

Coordinator
May 13, 2009 at 5:04 PM

I'm not familiar with how Google maps does it.

Did you look at the sample application?  It shows how to put pushpins on the map.

You can derive your own class from the VEPushPin class and do whatever you need, including customizing the look with standard WPF control templates.

May 14, 2009 at 6:35 AM

Yes, y look the sample application but I don't know how to put my own image into a VEPushpin object. I put an image in xaml file but I don't know hot to put an image in cs file.

This is the code in xaml file

 

<ve:VEPushPin Latitude="38.9444195081574"
                          Longitude="-77.0630161230201"
                          Click="VEPushPin_Click" >
                       
                <Image Source="file:/D:/SPP/Home.png"/>
              
  </ve:VEPushPin>

 

How can I change the "file:/D:/SPP/Home.png" image in cs file?

Coordinator
May 14, 2009 at 6:44 AM
Edited May 14, 2009 at 6:45 AM

Look at BitmapImage here:

http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.bitmapimage.aspx

 

There is sample code showing both XAML and C# how to load images from a file path.

Oct 22, 2009 at 12:38 PM

Hi everybody,

I'm working on the this virtualearthwpf project and trying to put pushpins dynamically according to the data in a database. I am new to this technology so please forgive me if this is a silly question. Now, I can only add pushpins using XAML file but I want to do it in cs file. Could you please show me a way or point to a source? Thanks in advance.

Coordinator
Oct 23, 2009 at 4:49 PM

Bilen,

You can use the same data binding/data template techniques you would use for any other type of ItemsControl.

Here is a good intro to using data templates:

http://msdn.microsoft.com/en-us/library/ms742521.aspx

In your case, you would want to bind the ItemsSource of the VEMap control to some (array/list) object that provides the data from your database.  For example, if you create a business object class called Locations with properties for Latitude, Longitude, and Name, you would want to databind to a List<Locations> type object.  You would need to write code to populate the list and the Location objects from your database.

Now if that is all you did, then it would be equivalent of this:

<VEMap [...] >

<Location [...] />

<Location [...] />

<Location [...] />

</VEMap>

That wouldn't be very useful because VEMap is expecting VEPushPin as children.  That is where the Data Template comes in.  Set up a data template like the link above describes, but put a VEPushPin in the data template, and bind the Latitude and other properties to the appropriate properties in your business object.

Oct 26, 2009 at 8:17 AM

First of all, thanks for your reply. I solved the previous problem with your help. Now I wonder if you can help me with using .KML data with BingMap. I will appreciate if you can help me with this issue.

Coordinator
Oct 26, 2009 at 1:44 PM

Great!

For your KML issue, perhaps you can post your question in a new thread so it will be easier to search and find the information later.

Oct 26, 2009 at 2:08 PM

Hi Joshb,

Thank you for your interest. Here is the thread that I started for the issue. http://virtualearthwpf.codeplex.com/Thread/View.aspx?ThreadId=73105 please help me.

 

Ugur