Get Knockout-WinJS

Adding the Knockout-WinJS adapter alongside of WinJS facilitates the usage of WinJS UI controls in a Knockout application.

For more information, check out the Knockout-WinJS documentation, examples and changelog on GitHub.

Knockout-WinJS 2.4.0 Direct Download (zip)

Package Manager

npm

npm install knockout-winjs

NuGet

Install-Package Knockout.WinJS

Usage

Include WinJS in your project as described on the downloads page for WinJS as well as Knockout 3.3+.

<link href="winjs/css/ui-dark.css" rel="stylesheet" />
<script src="winjs/js/base.js"></script>
<script src="winjs/js/ui.js"></script>
<script src="knockout-latest.js"></script>
<script src="knockout-winjs.js"></script>

Now you can declare a WinJS control with KnockoutJS style binding.

<!-- Shows up on the bottom of the screen -->
<div data-bind="winAppBar: {placement: 'bottom'}">
    <button data-bind="winAppBarCommand: {label: 'AppBarButton', type: 'button', icon:'add'}"></button>
</div>

WinJS controls that are declared like this will be created when you run ko.applyBindings on your script code.