0

In a Windows store app using Javascript, I have a listview defined in the html.

<div id ="menuListView" data-win-control="WinJS.UI.ListView" data-win-options="{
          itemDataSource: viewModel.items.dataSource,
          itemTemplate: menuItemTemplate,
          layout: {type: WinJS.UI.GridLayout}}"></div>

I could define a click event handler in Javascript something like this:

menuListView.addEventListener("selectionchanged", clickEventHandler, false);

But since, I'm trying to use the MVVM pattern, I would like to put this piece of code in the html view and let a viewmodel handle the click event. Would it be possible?

2 Answers 2

1

For full NVVM functionality in your WinJS app I would recommend using a framework like http://knockoutjs.com

Sign up to request clarification or add additional context in comments.

Comments

0

You can probably try something like this if you are keep to declare an event handler in HTML view :

"<button id="button1" onselectionchange="clickEventHandler(event)">An HTML button</button>"

Hope this helps :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.