I am currently working on a custom leaflet map that I load using a webview in my xaml where the user is able to perform several actions, such as adding and deleting existing markers. The problem I’m facing is the data passing part from this webview back to my C# code.
Structure:
- Map.xaml; contains my webview
- Map.xaml.cs; set image in the map and get values from my webview
- Map.html; Leaflet and all map functionalities
I tried using hidden fields where I put the changes the user made. So whenever the user deleted an item, I put this item inside the DeletedMarkers hidden field. Then back in my xaml.cs, I use:
var deleteMarkerData = await webView.EvaluateJavaScriptAsync("document.getElementById('deleteMarkerData').value");
here I either get a empty value or the marker object I deleted. I keep looping this to check if there is something inside this object every 0.2 seconds. This works, and I get the object correctly without much noticable delay, but now I was wondering if there is any way to get this object from my webview to my xaml.cs in a more performance friendly way.
Any suggestions?
HarrySocks is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.