I figured it out. I needed to add "on" to the event name. So instead of keyup it needs to be
onkeyup:
<body data-win-bindsource="Application.Home.ViewModel">
<input type="text" id="message-box" data-win-bind="value: message; onkeyup: changeMessage" />
<div data-win-bind="innerText: message"></div>
</body>
and in the JavaScript I'm binding the viewmodel by using the public namespace. So instead of using
_viewModel directly I am using Application.Home.ViewModel when calling
WinJS.Binding.processAll():
(function () {
"use strict";
var app = WinJS.Application;
var activation = Windows.ApplicationModel.Activation;
WinJS.strictProcessing();
var _viewModel = {
"ViewModel": WinJS.Binding.as({
"message": "test message",
changeMessage: function () {
Application.Home.ViewModel.message = document.querySelector("#message-box").value;
}
})
};
WinJS.Namespace.define("Application.Home", _viewModel);
app.onactivated = function (args) {
if (args.detail.kind === activation.ActivationKind.launch) {
args.setPromise(WinJS.UI.processAll().then(function () {
WinJS.Binding.processAll(null, Application.Home.ViewModel);
}));
}
};
app.start();
})();