xaml - click a textblock without selecting the parent listview item -


i'm developing windows store application c# , xaml. using listview display collection of data.

inside listview have data template has grids , textblock in grid. want tap/click textblock , give action without selecting parent listview item have event handle selected listview item. don't want both overlap.

thanks in advance response.

so want able select listviewitem when tapping 1 part of it, not textblock? if case, in textblock's tapped event add e.handled = true;. should make isn't further routed parent listview.

the other thing can (which more general solution whatever want listviewitems) not use thing selectionchanged event , instead handle itemclick. can deduce whether originalsource of event indeed textblock. then, if it's not textblock, change parent listview's selecteditem.

an example chceking originalsource

public static void itemclickevent(object sender, itemclickeventargs e) {     if(e.originalsource textblock)         donothingormaybetextblockevent();     else     {         listview.selecteditem = e.clickeditem;     } } 

hope helps.

edit: added example code originalsource check


Comments