我正在使用C#WPF和datagirid我需要特定的行颜色变化吗? [英] I am using C# WPF and datagirid I need specific row color change on condition?

查看:84
本文介绍了我正在使用C#WPF和datagirid我需要特定的行颜色变化吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

private void Liste()
{


ID = Convert.ToInt32(MainWindow.UserID);

var data = from p in dc.ToplantiTalepFormus from c in dc.Onays where p.Toplanti_Talep_ID == c.Toplanti_Talep_ID select new { p.Toplanti_Talep_ID, p.Toplanti_Talep_Tarihi, p.Toplanti_Tarihi, p.Toplanti_Saat, p.Toplanti_Konusu, p.Toplanti_Yeri, p.Toplanti_Şekli, p.Toplantı_Durumu, c.Toplantı_Onay, c.Yeni_Tarih, c.Yeni_Saat, c.DeğişiklikOnay, c.User_ID };

foreach (var ToplantiTalepFormus in data)


{
if (ToplantiTalepFormus.User_ID == 1)
{
Datagrid.RowBackground = Brushes.Red;
}
Datagrid.ItemsSource = data.ToList();

}
this is I try to do it but When I do
if (ToplantiTalepFormus.User_ID == 1)
{
Datagrid.RowBackground = Brushes.Red;
}





我的尝试:



这是我尝试做的但当我这样做时

if(ToplantiTalepFormus.User_ID == 1)

{

Datagrid.RowBackground = Brushes.Red;

}



What I have tried:

this is I try to do it but When I do
if (ToplantiTalepFormus.User_ID == 1)
{
Datagrid.RowBackground = Brushes.Red;
}

推荐答案

您已经在如何在条件下更改数据网格的行颜色?这对我来说很重要 [ ^ ]并收到了一些建议。请不要重新发布。
You already posted this question at How to change row color from datagrid on condition? It is importan for me[^] and received some suggestions. Please do not repost.


这篇关于我正在使用C#WPF和datagirid我需要特定的行颜色变化吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆