c# - Get location from bing map on Tap event in mvvm -
i'm trying location, when tap on bing map control. know how it, want make in viewmodel. tap event use interactions.
<map:map copyrightvisibility="collapsed" logovisibility="collapsed"> <map:maptilelayer> <map:maptilelayer.tilesources> <custommap:openstreettile /> </map:maptilelayer.tilesources> </map:maptilelayer> <map:maplayer> <map:pushpin location="{binding location}" /> </map:maplayer> <i:interaction.triggers> <i:eventtrigger eventname="tap"> <cmd:eventtocommand command="{binding addpushpincommand}" passeventargstocommand="true" /> </i:eventtrigger> </i:interaction.triggers> </map:map>
i can position eventarguments getposition function. function need uielement parameter.i made so:
var source = (e.originalsource maplayer).parentmap; var point = e.getposition(source); location = source.viewportpointtolocation(point);
but im not sure if solution. have idea how it? thanks
well, approach works , sometimes, enough enough. ;) if want 100% clean mvvm implementation, should avoid references view (and maplayer class) however.
joost van schaik wrote blog post shows how achieve using behaviors (it's windows phone 8, i'm sure applies windows phone 7 well): http://dotnetbyexample.blogspot.nl/2013/03/simple-reverse-geocoding-with-windows.html
Comments
Post a Comment