Inheritance: SetterBase, ISetter
 protected override Style SelectStyleCore(object item,
     DependencyObject container)
 {
     Style st = new Style();
     st.TargetType = typeof(ListViewItem);
     Setter backGroundSetter = new Setter();
     backGroundSetter.Property = ListViewItem.BackgroundProperty;
     ListView listView =
         ItemsControl.ItemsControlFromItemContainer(container)
           as ListView;
     int index =
         listView.IndexFromContainer(container);
     if (index % 2 == 0)
     {
         backGroundSetter.Value = (Color)Application.Current.Resources["SystemBackgroundAltHighColor"];
     }
     else
     {
         backGroundSetter.Value = (Color)Application.Current.Resources["SystemAltHighColor"];
     }
     st.Setters.Add(backGroundSetter);
     Setter paddingSetter = new Setter();
     paddingSetter.Property = ListViewItem.PaddingProperty;
     paddingSetter.Value = 0;
     st.Setters.Add(paddingSetter);
     Setter alignSetter = new Setter();
     alignSetter.Property = ListViewItem.HorizontalContentAlignmentProperty;
     alignSetter.Value = "Stretch";
     st.Setters.Add(alignSetter);
     return st;
 }
        protected override Style SelectStyleCore(object item, DependencyObject container)
        {
            var style = new Style {TargetType = typeof (ListViewItem)};
            var backgroudSetter = new Setter {Property = Windows.UI.Xaml.Controls.Control.BackgroundProperty};

            var listview = ItemsControl.ItemsControlFromItemContainer(container) as ListView;
            if (listview != null)
            {
                var index = listview.IndexFromContainer(container);
                backgroudSetter.Value = index%2==0 ? EvenColorBrush : OddColorBrush ;
            }
            style.Setters.Add(backgroudSetter);

            return style;
        }
        protected override Style SelectStyleCore(object item, DependencyObject container)
        {
            Style st = new Style();
            st.TargetType = typeof(ListViewItem);
            Setter backGroundSetter = new Setter();
            backGroundSetter.Property = ListViewItem.BackgroundProperty;
            ListView listView = ItemsControl.ItemsControlFromItemContainer(container) as ListView;
            int index = listView.IndexFromContainer(container);

            if (index % 2 == 0)
            {
                backGroundSetter.Value = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
            }
            else
            {
                backGroundSetter.Value = new SolidColorBrush(Color.FromArgb(75,255,255,255));
            }
            st.Setters.Add(backGroundSetter);
            return st;
        }
 private static Style GetDataPointStyleWithNoPointsRandomLineColors()
 {
     // If you suppress data points, then all line colors are yellow-orange by default.  Replace with random colors.
     // Adapted from http://stackoverflow.com/questions/5956564/wpf-toolkit-line-chart-without-points-and-with-different-colors
     // By Sanguin Yin, May 17 2011
     Random ran = new Random();
     Color background = Color.FromArgb(255, (byte)ran.Next(255), (byte)ran.Next(255), (byte)ran.Next(255));
     Style style = new Style(typeof(DataPoint));
     Setter st1 = new Setter(DataPoint.BackgroundProperty, new SolidColorBrush(background));
     Setter st2 = new Setter(DataPoint.BorderBrushProperty, new SolidColorBrush(Colors.White));
     Setter st3 = new Setter(DataPoint.BorderThicknessProperty, new Thickness(0));
     Setter st4 = new Setter(DataPoint.HeightProperty, 0);
     Setter st5 = new Setter(DataPoint.WidthProperty, 0);
     //Setter st6 = new Setter(DataPoint.TemplateProperty, null); // causes exception
     style.Setters.Add(st1); style.Setters.Add(st2); style.Setters.Add(st3); style.Setters.Add(st4); style.Setters.Add(st5);
     return style;
 }