WPF的datagrid 如何用2种颜色交替做每行背景颜色? 在Xaml里面设置一下就好了:<DataGrid AlternationCount="2" AlternatingRowBackground="PeachPuff" Name="myDataGrid" /> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //ListItemType.Item为奇数行//ListItemType.AlternatingItem为偶数行 switch (e.Item.ItemType) { case ListItemType.AlternatingItem:e.Item.BackColor=break; case ListItemType.Item:e.Item.BackColor=break;} 用repeater吧= =想怎么样就怎么样 构造函数: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; } c#嵌入暴风mps.dll组件问题 怎么做论坛用户的权限设置(新手) 如何解决!!!?? 关于一个图像处理的比较难的问题。 有没人遇到过拖动GROUPBOX时,GROUPBOX中的东西会有拖影? 多肽与接口的区别 image类型的字段可以为空,插入数据时此字段没有插入任何值,在代码里又怎么判断此字段的值为空呢? 初学者的问题,请进来拿分 怎样设置datagrid的每一列的标题? 关于水晶报表打印的问题,高分相赠,不够再加。(100) C#分离度分秒 WIN8置顶 隐藏侧边栏 左侧切换程序
//ListItemType.AlternatingItem为偶数行
switch (e.Item.ItemType)
{
case ListItemType.AlternatingItem:
e.Item.BackColor=
break;
case ListItemType.Item:
e.Item.BackColor=
break;
}
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;
}