c# - Windows Phone 8.1 listview click to change page -
for school have make windows phone 8.1 program (in mvvm style) i’m stucked.
i have list of cocktails , them in listview, dynamically bindings:
<listview itemssource="{binding cocktails}" itemtemplate="{staticresource allcocktailstemplate}" > </listview>
it looks that: http://hpics.li/08e9e96
it works want when click on cocktail, change page go page of cocktail.
the navigation works don’t know how on listview each cocktails (which db)
i’m on yesterday morning, found nothing useful me on internet hope me :p
if need more informations, ask me
jonny
listview/gridview have itemclick event, subscribe it
xaml:
<listview itemclick="onpostitemclick" isitemclickenabled="true">
code:
private void onpostitemclick(object sender, itemclickeventargs e) { // navigate cocktail page item click/tap on frame.navigate(typeof(yourpage), e.clickeditem); }
if want use command itemclick event need add behaviors sdk, use way
<page ... xmlns:i="using:microsoft.xaml.interactivity" xmlns:c="using:microsoft.xaml.interactions.core"> <listview> <i:interaction.behaviors> <c:eventtriggerbehavior eventname="itemclick"> <c:invokecommandaction command="{binding path=yourcommand}"/> </c:eventtriggerbehavior> </i:interaction.behaviors> </listview>
Comments
Post a Comment