在Xaml里面设置一下就好了:
<DataGrid AlternationCount="2" AlternatingRowBackground="PeachPuff" Name="myDataGrid" />

解决方案 »

  1.   

      //ListItemType.Item为奇数行
    //ListItemType.AlternatingItem为偶数行
     switch (e.Item.ItemType)
            {
                case ListItemType.AlternatingItem:
    e.Item.BackColor=
    break;
                case ListItemType.Item:
    e.Item.BackColor=
    break;
    }
      

  2.   

    用repeater吧= =想怎么样就怎么样
      

  3.   

    构造函数:this.dgList.LoadingRow += new EventHandler<DataGridRowEventArgs>(dgList_LoadingRow);
     void dgList_LoadingRow(object sender, DataGridRowEventArgs e)
            {
                int index = e.Row.GetIndex();
                if (index % 2 == 0)
                {
                    e.Row.Background = Brushes.Gray;  // color
                }
                else {
                    e.Row.Background = Brushes.Yellow;
                }
                //e.Row.Header = index + 1;
            }