Metro app - ListView - how to alternate background colour of ListViewItems

前端 未结 4 833
没有蜡笔的小新
没有蜡笔的小新 2020-12-19 04:26

In my Metro style app for Windows 8, I\'m binding a Listview to an ObservableCollection and I would like the background color of each ListViewItem to alternate (white, gray

4条回答
  •  盖世英雄少女心
    2020-12-19 04:56

    I search online and found a technique that included adding an index property to the model in question and then adding a converter to the DataTemplate. This wasn’t ideal because it only changed the contents of the list item, so depending on padding and content alignment you’d see gaps around the row background. I also didn’t like the code smell of modifying my data model objects with UI code.

    Try this it will help, http://www.bendewey.com/index.php/523/alternating-row-color-in-windows-store-listview

提交回复
热议问题