private static void ColorContainerContentChanging(Windows.UI.Xaml.Controls.ListViewBase sender, ContainerContentChangingEventArgs args) { var itemContainer = args.ItemContainer as SelectorItem; var itemIndex = sender.IndexFromContainer(itemContainer); if (itemIndex % 2 == 0) { itemContainer.Background = GetAlternateColor(sender); } else { itemContainer.Background = null; } }
private static void ItemTemplateContainerContentChanging(Windows.UI.Xaml.Controls.ListViewBase sender, ContainerContentChangingEventArgs args) { var itemContainer = args.ItemContainer as SelectorItem; var itemIndex = sender.IndexFromContainer(itemContainer); if (itemIndex % 2 == 0) { itemContainer.ContentTemplate = GetAlternateItemTemplate(sender); } else { itemContainer.ContentTemplate = sender.ItemTemplate; } }