Monday 15 April 2013

c# - How to have a ListBox child item event not call parent event? -



c# - How to have a ListBox child item event not call parent event? -

problem

when click on listview item, calls "tapped" event navigate page. have vote event within itemtemplate , when phone call specific event, not want phone call listview's tapped event. thought how might that?

listview xaml:

parent event, "listboxfeedbackitem_tapped", occurs anytime part of listview clicked

<grid x:name="gridmaindata" grid.row="2"> <progressbar x:name="prgbar" isindeterminate="true" verticalalignment="top" visibility="{binding path=feedbackvm.isloading, mode=twoway}"/> <listview itemtemplate="{staticresource feedbacktemplate}" itemssource="{binding feedbackvm.feedbackcollection}" tapped="listboxfeedbackitem_tapped"/> </grid>

itemtemplate xaml:

event "upvoteitem_tap" should not trigger "listboxfeedbackitem_tapped"

<datatemplate x:key="feedbacktemplate"> <stackpanel orientation="horizontal"> <textblock margin="0,0,30,0" text="{binding upvotes}" tapped="upvoteitem_tap"/> </stackpanel> </datatemplate>

perhaps there's method in c# prevent subsequent events occurring? thanks, i'm still trying wrap head around xaml.

when receive upvote tapped event, can tell not pass event parent listview setting e.handled=true:

void upvoteitem_tap(object sender, tappedroutedeventargs e) { // processing here ... // don't send event parent e.handled = true; }

c# xaml windows-store-apps winrt-xaml

No comments:

Post a Comment