wpftoolkit - Change windows phone toolkit pushpin content -
how change content of toolkit pushpin via program dynamically?
i've put several pushpins on maps on initializing, , want change content of pushpin while user put tap on it.
this xaml code:
<toolkit:mapextensions.children> <toolkit:mapitemscontrol x:name="mapitems"> <toolkit:mapitemscontrol.itemtemplate> <datatemplate> <toolkit:pushpin geocoordinate="{binding coordinate}" tap="pinontap"> <toolkit:pushpin.template> <controltemplate targettype="toolkit:pushpin"> <stackpanel> <contentpresenter x:name="content" horizontalalignment="center" content="{templatebinding content}" /> <path data="m0,0 l0,1 l1,0" fill="{templatebinding background}" stretch="fill" margin="32,0" height="12" width="18" visibility="{binding content.visibility, mode=twoway, relativesource={relativesource templatedparent}}" horizontalalignment="left" /> <image source="{binding icon_img}" stretch="none" horizontalalignment="left"/> </stackpanel> </controltemplate> </toolkit:pushpin.template> <border background="white" visibility="collapsed" width="200" horizontalalignment="center" > <stackpanel orientation="horizontal" tap="gotoprofilefrompin"> <image margin="8" source="{binding image}" verticalalignment="top" width="50" height="50" /> <stackpanel> <textblock text="{binding uid}" visibility="collapsed"/> </stackpanel> </stackpanel> </border> </toolkit:pushpin> </datatemplate> </toolkit:mapitemscontrol.itemtemplate> </toolkit:mapitemscontrol> </toolkit:mapextensions.children>
and program.cs:
private void pinontap(object sender, system.windows.input.gestureeventargs e) { var popout = ((sender pushpin).content) border; popout.visibility = system.windows.visibility.visible; var popoutimg = (popoutnew.child stackpanel).datacontext; var popuser = popoutimg userpin; // function images uid popuser.image = new uri(images fetch function, urikind.relativeorabsolute); popoutnew.child.updatelayout(); e.handled = true; }
in pinontap function, i'll fetch picture function , show on maps toolkit:pushpin.content, can't work.
this code:
popuser.image = new uri(images fetch function, urikind.relativeorabsolute);
it change image source not update ui. print it's value , source has been changed, donno why didn't appear on map (the map show "border" white background , didn't have image inside it)
i think have implement inotifypropertychange th change not reflected on xaml .
Comments
Post a Comment