WinJS.Binding.Template.prototypeの拡張

WinJS.UI.ListViewのitemTemplateやgroupHeaderTemplateの中で、何番目のindexか? グループ内にいくつ項目があるか? とかを出力したいなあと思っていたのですが、適切なAPIが用意されていないみたいです。ドキュメントには書いていないですが、WinJS.Binding.Template.prototype.renderItemに渡ってくる引数にその情報が入っていて使えそう。

    var renderItem = WinJS.Binding.Template.prototype.renderItem;
    WinJS.Binding.Template.prototype.renderItem = function (item) {
        var data = item._value.data;
        data._index = item._value.index;
        data._groupSize = item._value.groupSize;
        return renderItem.apply(this, arguments);
    };
    <div class="headerTemplate" data-win-control="WinJS.Binding.Template">
        <h2 class="group-title" data-win-bind="onclick: click; textContent: _groupSize" role="link"></h2>
    </div>
    <div class="itemtemplate" data-win-control="WinJS.Binding.Template">
        <img class="item-image" src="#" data-win-bind="src: backgroundImage; alt: title" />
        <div class="item-overlay">
            <h4 class="item-title" data-win-bind="textContent: title"></h4>
            <h6 class="item-subtitle win-type-ellipsis" data-win-bind="textContent: _index"></h6>
        </div>
    </div>