I am using following template for the WinJS.UI.ListView.
<div class="lst-item" data-win-control="WinJS.Binding.Template" id="plyListTemp">
<span class="sng-name win-type-ellipsis" data-win-bind="textContent: title">Loreum ipsum</span>
<a style="color:red;">X</a>
<strong class="pri_artist win-type-ellipsis" data-win-bind="textContent: primary_artist">A boy name goo</strong>
<span class="time" data-win-bind="textContent: duration">06:44</span>
</div>
Now I want to add a click listener to the anchor (a) specified in above template.
How do I achieve it.I am aware of onItemInvoked listener of WinJS.UI.ListView and I already set that but How would I know that user clicked on the anchor?
How can I add event listener to button which is inside itemTemplate using XAML,C# for building application.
Any Highly appreciated.
You must use the win-interactive class along with a custom template render. This article talks about working with template renders at the end – http://msdn.microsoft.com/en-us/library/windows/apps/Hh781224.aspx#displaying_items_with_a_template_or_render_function and this sample application shows how to create interactive template items in scenario 6 – http://code.msdn.microsoft.com/windowsapps/ListView-item-templates-7d74826f