Marker and route in WPF version

May 8, 2009 at 2:01 PM


I use GMap in my WPF application but I don't know how add marker and create route in maps. Can you help mi ? It is very important for mi.

May 8, 2009 at 4:46 PM

wpf version isn't complete yet, but you can manualy add shapes, draw routes to canvas

May 8, 2009 at 5:04 PM

Can You tell mi how I add routes in canvas ?

It is very important for mi because I wrote main project for study.

Maby I Can help You and together complete faster ?

May 8, 2009 at 5:07 PM

maybe, but why you want to use wpf version instead windows forms?

May 8, 2009 at 5:19 PM

I start wrote my application before I find yours greate application, and WPF application is look better. WPF is future ;)

Can You tell mi how I add some point to map if I have PointLatLng ?

How You calculate scale ?

May 8, 2009 at 5:36 PM

i see, i like some wpf features too! If you noticed wpf demo is with with testing markers, i wanna to make object list thread safe, but with wpf visible objects there is problem, any ideas?

May 8, 2009 at 5:50 PM
Edited May 8, 2009 at 5:52 PM

I found code with add circle (metod worker_DoWork) and it worker for mi. I comment this metod and tray to add marker. I comment line

this.ItemsSource = Objects

and if add marker I add

GMapMarkerCross c = new GMapMarkerCross(this);

CurrentMarker = c;Marker show mi but I don't know how add another marker and how scale it.


and in metod GMap_Loaded wrote







May 8, 2009 at 7:15 PM

markers done! enjoy :}

p.s. routes are comming soon "_^

May 9, 2009 at 8:56 AM

 Thank, thank, big thanks for You ;) 

I saw you changes and I improved icon for markers. I created object with look similarly to google markers. Insite object I create events MouseEnter and MouseLeave.


How show You my changes ?


How I can help you about routes ??

May 9, 2009 at 10:21 AM

if you create or fix something just upload a patch and i'll try to realize it

May 9, 2009 at 10:35 AM

I added my path. Can You look if is ok ? Today I'm improving demo. Add case to add more markers in map.

May 9, 2009 at 10:37 AM

i'm exploring it right now

May 9, 2009 at 6:06 PM

I have one question for You.

Can You tell mi When You planing end a rote ?? This function is very very important for mi. Please ;)

May 9, 2009 at 6:19 PM

;} if it relly is, you can make it yourself, else wait some week or two... ;}

May 9, 2009 at 6:32 PM
Edited May 9, 2009 at 6:40 PM

I was trying but I don't know how add another object list (route list) to itemSource 

this.ItemsSource = Markers;

Big please

May 9, 2009 at 6:38 PM

marker and routes are different stuff

May 9, 2009 at 6:44 PM

I know but I don't know how add trace to map object :( 

I have point for trace between two point and .... I don't now how show this trace in map :(

May 9, 2009 at 6:46 PM

programming is learning how to do unknow things or waiting for new release ;}

May 9, 2009 at 6:51 PM

please, wrote new release in this working week

May 9, 2009 at 7:11 PM

hi radioman,


i think i have a similar question.  i am using the control in to track vehicles, i would like a way of displaying a 'snail-trail'  of the route.  it is possible for me to build a route object?  i have lists of all the long/lat co-ords and wonder if the route object is simply a collection of these?.

also, i looked at your demo of the WPF screen, it looks interesting, may i ask what the application is you are developing ?



May 9, 2009 at 7:16 PM

some vehicle tracking application for my company, so as you see routing is working, just need to include some stuff in wpf control

May 9, 2009 at 7:16 PM

now, two peopel waiting for new release ;)

May 9, 2009 at 8:13 PM

well i am using WinForms..  pls , how do i construct a route object ? what elements are required.  what you are doing is exacly what i need to do also,




May 9, 2009 at 8:14 PM

there is perfect example in demo, "Add route" button event

May 9, 2009 at 8:23 PM

right thanks,  i also just thought,  since we have the source code, then i can just see exactly how you plot the route.

thanks again,


May 9, 2009 at 8:25 PM

yeah, you can even oweride that function if you want draw yourself

May 13, 2009 at 1:21 PM

manual route creation:

internal Path CreateRoute(List<System.Windows.Point> pl)


         // Create a path to draw a geometry with.

         Path myPath = new Path();

         myPath.Stroke = Brushes.Navy;

         myPath.StrokeThickness = 5;

         myPath.StrokeLineJoin = PenLineJoin.Round;

         myPath.StrokeStartLineCap = PenLineCap.Triangle;

         myPath.StrokeEndLineCap = PenLineCap.Square;

         myPath.Opacity = 0.6;


         // Create a StreamGeometry to use to specify myPath.

         StreamGeometry geometry = new StreamGeometry();


         using(StreamGeometryContext ctx = geometry.Open())


            ctx.BeginFigure(pl[0], false, false);


            // Draw a line to the next specified point.

            ctx.PolyLineTo(pl, true, true);



         // Freeze the geometry (make it unmodifiable)

         // for additional performance benefits.



         // Specify the shape of the Path using the StreamGeometry.

         myPath.Data = geometry;


         BlurEffect ef = new BlurEffect();


            ef.KernelType = KernelType.Gaussian;

            ef.Radius = 3.0;

            ef.RenderingBias = RenderingBias.Quality;


         myPath.Effect = ef;


         return myPath;



      internal void SetNewRoute(bool Direction, int ScheduleName)





            List<System.Windows.Point> pl = new List<System.Windows.Point>();

            var tt = from p in Trasos

                     where p.Direction == Direction && p.ScheduleName == ScheduleName

                     select p;

            var first = tt.FirstOrDefault();

            if(first != null)


               currentRoute = null;

               currentRoute = new GMapMarker(MainMap, new PointLatLng(first.Lat, first.Lng));

               var pp = MainMap.FromLatLngToLocal(new PointLatLng(first.Lat, first.Lng));


               foreach(var i in tt)


                  var p = MainMap.FromLatLngToLocal(new PointLatLng(i.Lat, i.Lng));

                  pl.Add(new System.Windows.Point(p.X - pp.X, p.Y-pp.Y));



               var rt = CreateRoute(pl);                

               currentRoute.Shape = rt; 





         currentDirection = Direction;

         currentScheduleName = ScheduleName;


May 13, 2009 at 4:37 PM

Hi radioman

Did you do something about route in WPF ?

May 13, 2009 at 5:46 PM

you can add route as marker

May 13, 2009 at 6:26 PM

I think this solution, is it good way ? I thinking about I create a new shape for markers (it is route) and add in ItemSource. All object is in one sack. What do you think about this metod ?

May 13, 2009 at 6:28 PM

yes, thats what i've tryed to explain ;}

May 13, 2009 at 6:59 PM

Ok, I do it in this week. Thanks ;)

May 13, 2009 at 7:00 PM

i'll do it in 30minutes for demo ;}

May 13, 2009 at 7:12 PM

You are very faster programmer ;)

May 13, 2009 at 7:43 PM

done! ;} thx

May 13, 2009 at 8:25 PM

thank very much

May 13, 2009 at 8:37 PM

welcome! ;}