c# - How to create clickable pin in MapControl on Windows Phone -


i had following code in xaml

<listview grid.row="2" grid.columnspan="2"  visibility="{binding switchtext}"  itemssource="{binding path=filteredrestaurants}" selectionmode="single" isitemclickenabled="true">                         <listview.itemtemplate>                             <datatemplate>                                 <stackpanel>                                     <textblock text="{binding name}" style="{staticresource textblockinfofritheme}"                                      textwrapping="wrap" />                                 </stackpanel>                             </datatemplate>                         </listview.itemtemplate>                         <interactivity:interaction.behaviors>                             <core:eventtriggerbehavior eventname="itemclick">                                 <core:invokecommandaction command="{binding path=showdetailcommand}" />                             </core:eventtriggerbehavior>                         </interactivity:interaction.behaviors> </listview> 

and viewmodel

showdetailcommand = new delegatecommand<itemclickeventargs>(async (args) =>             {                 restaurant restaurant = args.clickeditem restaurant;                 messagedialog dialog = new messagedialog(restaurant.tostring());                 await dialog.showasync();             }); 

that works fine when click on item, tried same aproach in maps , dosent work. google problem cant use isitemclickenabled="true" anywhere here other options? because id have same functionality when click on pin.

so xaml other pivotitem:

<maps:mapitemscontrol itemssource="{binding filteredrestaurants}"  >                         <maps:mapitemscontrol.itemtemplate>                             <datatemplate >                                 <stackpanel                              maps:mapcontrol.normalizedanchorpoint="0.5,1"                              maps:mapcontrol.location="{binding coordinates,converter={staticresource coordinatestogeopointconverter}}"                             width="auto" height="auto"  >                                  <interactivity:interaction.behaviors>                                     <core:eventtriggerbehavior eventname="itemclick">                                         <core:invokecommandaction command="{binding showfoodlocationdetails}" />                                     </core:eventtriggerbehavior>                                 </interactivity:interaction.behaviors>                                  <grid x:name="foodcontentgrid"  height="auto" width="auto" >                                     <rectangle fill="#ff3fc500" height="auto" width="auto" radiusx="3" radiusy="3"/>                                     <stackpanel horizontalalignment="center" margin="5" >                                         <textblock x:name="foodlocationname"  text="{binding name}" fontsize="14" foreground="white" horizontalalignment="center" />                                     </stackpanel>                                 </grid>                                 <path data="m33.4916,35.3059 l42.1937,35.3059 l38.1973,40.6036 z" fill="#ff3fc500" horizontalalignment="center" height="6.302" margin="0,-1,0,0" stretch="fill" uselayoutrounding="false" width="9.702"/>                             </stackpanel>                         </datatemplate>                     </maps:mapitemscontrol.itemtemplate>                 </maps:mapitemscontrol> 

so id gratefull suggestions on how ivoke commad. semi related question. possible use mapicon in strictly mvvm architecture? because looked better when used maps in code behind views im changing cause having strict mvvm more important


Comments