C-3ow
C-3ow

Reputation: 61

Add Markers in WPF

I need to add markers to my map. Problem: I'm using WPF, not WinForms.

GMapMarker marker = new GMapMarker(new PointLatLng(-25.966688, 32.580528));
gmap.Markers.Add(marker);

Now according to this question the solution is:

marker.Shape = new MarkerShape(....);

Could someone explain to me, how to I initalize this shape?

Thanks!

Upvotes: 2

Views: 5066

Answers (2)

Niko
Niko

Reputation: 832

You have to add a new UserControl - your own, and inside the control put a image you like (for example pin image). Note that all the events (like Click event) must be implement inside a control.

After that you can add the marker like:

        GMapMarker marker = new GMapMarker(new PointLatLng(##, ##));
        marker.Shape = new PinControl();
        gmap.Markers.Add(marker);

Upvotes: 0

C-3ow
C-3ow

Reputation: 61

I resolved the problem with:

marker.Shape = new Ellipse
            {
                Width = 10,
                Height = 10,
                Stroke = Brushes.Black,
                StrokeThickness = 1.5
            };

That's a little black circle.

Upvotes: 3

Related Questions