c# - WP8: LongListMultiSelector Tap Item Trigger MVVM -


another question concerning longlistmultiselector (windows phone 8 toolkit). want start command when tapping on single item in longlistmultiselector.

xaml

  <local:longlistmultiselector                     x:name="filelist"                     itemssource ="{binding currentfilelist}"                     enforceisselectionenabled="{binding isinselectionmode}"                      toolkit:tilteffect.istiltenabled="true"                      isselectionenabled="true"                      itemcontainerstyle="{staticresource filebrowserlonglistmultiselectorstyle}"                      selectedfiles="{binding selectedfiles}">                     <local:longlistmultiselector.itemtemplate>                         <datatemplate>                             <stackpanel orientation="horizontal" margin="0,0,0,20">                                 <rectangle width="80" height="80" fill="{staticresource boxcryptorgreenbrush}"/>                                 <stackpanel margin="10,0">                                     <textblock text="{binding name}" style="{staticresource phonetextlargestyle}"/>                                     <textblock text="{binding size}" style="{staticresource phonetextsmallstyle}"/>                                 </stackpanel>                                                 <i:interaction.triggers>                                     <i:eventtrigger eventname="tap">                                         <i:invokecommandaction command="{binding taponfilecommand}" commandparameter="{binding}"/>                                     </i:eventtrigger>                                 </i:interaction.triggers>                                  </stackpanel>                         </datatemplate>                     </local:longlistmultiselector.itemtemplate>                   </local:longlistmultiselector> 

and in viewmodel:

filebrowserviewmodel

// command public relaycommand<file> taponfilecommand { get; private set; }  // constructor public filebrowserviewmodel() {     taponfilecommand = new relaycommand<file>(             taponfile,             (f) => true); }  // method private void taponfile(file file) {    if (file.isfolder)    {         _currentfilelist = file.children;    } } 

now taponfilecommand never executed. intellisense finds command xaml file. missing? i'm using mvvm light , prefer not write (to much) code behind.

here's solution:

i had move taponfilecommand in fileviewmodel (elements inside list). datacontext inside of single item itself. output gave relevant hints.


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -