Control problems?!

Dec 1, 2009 at 8:23 AM

Radioman,

Now that i know how to solve what i want i start all over. This time in WPF.

After starting up a new project i have tried to drag the control to my frame. But can not get control on frame.

It is in my toolbar, i have added the references to the DLL's.

What can be wrong??

Heru

 

 

Coordinator
Dec 1, 2009 at 8:26 AM

no idea, try just include control namespace in xaml

Dec 1, 2009 at 11:16 AM

Solved,

Disposed the project and started a new one in same matter.

Strange but true.

Hein

Coordinator
Dec 1, 2009 at 4:26 PM

and it worked? .i know in windows form can be Design mode detection issues, but on wpf it should work well

Dec 2, 2009 at 11:05 AM

Yes it is working now. But now i encounter problems due to differences between Windows.Forms and WPF. In Windows forms i could draw shapes on gmapcontrol but in WPF i can not draw on gmapcontrol.(don't know how)  In Windows.Forms i could use handle of gmapcontrol to "connect" graphics to gmapcontrol. But i don't know how to do this is WPF. I have looked in your WPF demo but couldn't find out how you do the circle trick. (how hard can it be???) again) any help from your side?

Heru

 

 

Coordinator
Dec 2, 2009 at 11:08 AM

well it's just a circle shape added to markers, check functions in demo:

  • AddDemoZone
  • UpdateCircle

quite easy ;}

Dec 2, 2009 at 12:48 PM

Quite easy....

I have tried to figure out, but still don't know how to set my drawn polygon as a marker, or how to set a marker as a polygon...

So probably i am stupid because still not working

 

Heru

 

Coordinator
Dec 2, 2009 at 2:14 PM

probably, you need to create some visual(via xaml or in code) and use it as a marker ;}

Dec 2, 2009 at 2:38 PM

This is what i have so far

Dim myMarker As GMapMarker = New GMap.NET.WindowsPresentation.GMapMarker(myPoint)
Dim myPolygon As New Polygon()
myPolygon.Stroke = System.Windows.Media.Brushes.Black
myPolygon.Fill = System.Windows.Media.Brushes.LightSeaGreen
myPolygon.StrokeThickness = 2
myPolygon.HorizontalAlignment = HorizontalAlignment.Left
myPolygon.VerticalAlignment = VerticalAlignment.Center
myPolygon.Points = myPointCollection
myMarker.Shape.TransformToVisual(myPolygon)
GMapControl1.Markers.Add(myMarker)
' myPoint is lat/lng coordinate
' myPointCollection is filled with latlngtolocal coordinates
Code gives error: Objectreference not set to instance of an object
Any idea?
Coordinator
Dec 2, 2009 at 2:48 PM
myMarker.Shape.TransformToVisual(myPolygon) wtf? ;}
Dec 2, 2009 at 3:34 PM

myMarker.shape = myPolygon did the job.

 

Dec 2, 2009 at 4:34 PM

Complety working now, including zoom and opacity.

As always not to difficult at the at.......

 

Coordinator
Dec 2, 2009 at 4:36 PM

great! Keep going ;}

Dec 3, 2009 at 3:27 PM

Heru,

Can you please share how you implemented zoom? I assume it's a variation of the WPF Demo's UpdateCircle?

Thanks for your consideration.

Dec 3, 2009 at 3:32 PM

djlaycock,

What is do is:

1) Obtain a list of the coordinates which present my polygon

2) read coordinates and draw polygon

When zooming repeat step 2

 

For me this is the easiest way. Building and drawing polygon is just fraction of second.

If you like i can share code with you.

 

Heru

Coordinator
Dec 3, 2009 at 3:35 PM

yes, and you can use FromLatLngToLocal for building the polygon

Dec 4, 2009 at 4:35 PM

Heru, as you offered in you last post, can you please share your code?