locked
data-win-bind: bind to property of defined class in Item template RRS feed

  • Question

  • I have an ItemTemplate displayed in my ListView. I want to bind display property of my ItemTemplate's div to property of my defined class:

    WinJS.Class.define(GroupedItemsGuiEvents);

        <div id="itemtemplate" class="itemtemplate" data-win-control="WinJS.Binding.Template">
            <div class="item">
                ... some content ...
                </div>
    		<div data-win-bind="style.display: GroupedItemsGuiEvents.currentMode GroupedItemsGuiEvents.itemTypeToActivationConverter" style="background-color: rgba(255, 255, 255, 0.447); display: none;" ></div>
            </div>
        </div>

    Unfortunatly, it doesn't work. How should I do it?

    It works if I do the binding to the property of current item, represented by the ItemTemplate. The problem is, when I want to bind it to a property from a class (GroupedItemsGuiEvents), not the current item.

    Can sb help me with this binding?

    Thanks, greetings


    Monday, May 6, 2013 8:59 AM

Answers

  • Hi,

    I do not think you can do that. For a item binding the data should have the property.

    Also you can only have one data source to the list view. Here you are trying to attach multiple datasources to the list view.

    Can you use a templating function and add this element using that. I can think of only this approach.

    - Girija

    Monday, May 6, 2013 9:08 PM