DataGrid中行背景色和字体颜色的设置
2010-03-02 16:58
399 查看
DataGrid加载事件:
private void dgvNotesManage_LoadingRow(object sender, DataGridRowEventArgs e)
{
try
{
DataRowView drv = e.Row.Item as DataRowView;
if (drv != null)
{
if (!drv["NoteCategory"].ToString().IsNullOrEmpty())
{
if (drv["NoteCategory"].ToString().Trim() == "重要")
{
e.Row.Foreground = new SolidColorBrush(Colors.Red);//前景色即字体的颜色
e.Row.Background = new SolidColorBrush(Colors.Red);//背景色
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void dgvNotesManage_LoadingRow(object sender, DataGridRowEventArgs e)
{
try
{
DataRowView drv = e.Row.Item as DataRowView;
if (drv != null)
{
if (!drv["NoteCategory"].ToString().IsNullOrEmpty())
{
if (drv["NoteCategory"].ToString().Trim() == "重要")
{
e.Row.Foreground = new SolidColorBrush(Colors.Red);//前景色即字体的颜色
e.Row.Background = new SolidColorBrush(Colors.Red);//背景色
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
相关文章推荐
- Eclipse详细设置护眼背景色和字体颜色并导出
- markdown设置字体颜色大小和背景色
- MFC 可以设置背景色、字体、字体颜色、透明背景的 Static 静态文本控件
- (详解)Eclipse详细设置护眼背景色和字体颜色并导出
- 应用键横竖屏切换;label中显示图片;不同类型设备适配的代码;UIWebView字体大小、字体颜色、背景色的设置;
- eclipse设置护眼豆沙绿背景色以及字体颜色
- markdown编辑器语法——文字颜色、大小、字体与背景色的设置(转)
- markdown编辑器语法——文字颜色、大小、字体与背景色的设置(转)
- markdown 设置字体、字号、颜色以及背景色
- java代码设置Burron、Radiobutton的背景色和字体颜色
- Eclipse详细设置护眼背景色和字体颜色并导出(转自百度)
- User select font-face/color/size/backgroundColor设置 字体,颜色,大小,背景色兼容主流浏览器
- MFC中可以设置字体颜色,背景色,前景色,是否透明
- 设置对话框、static和group的背景色和字体颜色
- 设置对话框、static和group的背景色和字体颜色
- MFC 可以设置背景色、字体、字体颜色、透明背景的 Static 静态文本控件
- UITableViewCell背景色.选中背景色,分割线,字体颜色设置
- MFC中设置static text控件的背景色、字体、字号和颜色
- MFC静态文本控件如何设置字体--大小和颜色及背景色
- 设置ActioinBar 的背景色以及Title的字体颜色