How to add a marker to .png map image on Windows Phone? -
i have windwows phone application allows user see on map initial position acquired scanning qr code. when user scans qr code, gets url map stored in web server , x , y coordinates of initial position.
i've created container of map image in .xaml page :
<image x:name="imagepanel" width="470" margin="5,0,5,98" grid.row="1" />
in .cs page, downloaded map image server :
public void downloadimage(string urlmappa) { imagepanel.source = new bitmapimage(new uri(urlmappa)); webclient wc = new webclient(); wc.openreadcompleted += new openreadcompletedeventhandler(wc_openreadcompleted); seek { wc.openreadasync(new uri(urlmappa), wc); } grab (exception ex) { messagebox.show(ex.message); } } void wc_openreadcompleted(object sender, openreadcompletedeventargs e) { if (e.error == null && !e.cancelled) { seek { bitmapimage image = new bitmapimage(); image.setsource(e.result); imagepanel.source = image; } grab (exception ex) { messagebox.show(ex.message); } } else { messagebox.show("it's impossibile download map server"); } }
...and works hard part marking locations on image (report).
i've found :
public void marklocation(int posizionex, int posizioney) { var imagemarker = new system.web.ui.webcontrols.image { imageurl = "/pin.jpg" }; imagemarker.style.value = string.format("position:absolute;top:{0}px;left:{1}px;display:block;width:30px; height:30px;", point.x, point.y); imagepanel.controls.add(imagemarker); }
but doesn't work on windows phone.
i'm interested in suggestions on how mark location on (over) image given x,y coordinates.
alternative approaches appreciated.
you can place image on canvas , position marker element absolutely trying webcontrol. alternatively, write marker on image using writeablebitmapex
image windows-phone-7 map marker
No comments:
Post a Comment