绑定下拉选择的值

时间:2012-09-07 10:21:55

标签: microsoft-metro

如何使用data-win-bind

绑定Metro风格应用中下拉列表的选定值
 <select class="win-interactive itemCount" data-win-bind="itemKey: key; selected: quantity; selectedValue: quantity; value: quantity;" >
                        <option>1</option>
                        <option>2</option>
                        <option>3</option>
                        <option>4</option>
                        <option>5</option>
                    </select>

1 个答案:

答案 0 :(得分:2)

在select标记上使用repeater并将其绑定到值列表和内容:

<select id="repeater" data-win-control="WinJS.UI.Repeater">
    <option data-win-bind="value: Val; textContent: Content"></option>
</select>