Reputation: 2824
I want to alternate color of items in ItemsControl based on item index - odd or even. As I found here it is pretty easy to do, but looks like ItemsControl for Windows Phone doesn't have AlternationCount property.
Is there any alternatives to AlternationCount property or workarounds to achieve required behavior?
Upvotes: 3
Views: 240
Reputation: 1402
You could inherit the ItemsControl class and override PrepareContainerForItemOverride. There you can calculate the AlternationIndex e.g. by using ItemsControl.IndexFromContainer. Now you can apply a specific Style to the container or set an attached property.
Upvotes: 1