I use Leaflet in my WPF C# program. I want to draw polygon on the map. I use System.Windows.Forms.WebBrowser for showing the map:
<Grid>
<WindowsFormsHost Name="wfhSample">
<WindowsFormsHost.Child>
<wf:WebBrowser x:Name="webBrowser" DocumentTitleChanged="wbWinForms_DocumentTitleChanged" />
</WindowsFormsHost.Child>
</WindowsFormsHost>
</Grid>
I get script error from the leaflet every time I run the program with L.polygon
(but it works without errors if I draw L.circle
or L.marker
or if I don't draw anything on the map) added to my map in leaflet.html file:
var polygon = L.polygon([
[0.939, 0.68],
[0.933, 0.66],
[0.940, 0.67]
]).addTo(map);//shows map without polygon and with next error
P.S. But when I open leaflet.html with Edge browser the polygon is drawn on the map without any problem. What is the reason of this error shows every time I run the program?
L.polygon
code thatSystem.Windows.Forms.WebBrowser
component does not like. If you can debug JS when usingSystem.Windows.Forms.WebBrowser
, useleaflet-src.js
and check where it goes wrong. Another possiblity would be to try the latest Leaflet 1.9.3.