elec60
پنج شنبه 21 خرداد 1394, 19:55 عصر
سلام
یک Collection به ِDataGrid بايند کردم و در متد LoadingRow بر اساس شرایطی رنگ Row ها رو ست کردم.
رنگها درست ست میشن اما وقتی با ScrollBar اسکرول میکنم رنگها تغيير میکنن!!!!!
private void datagrid_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.Header = (e.Row.GetIndex() + 1);
var ee = e.Row.Item as EnterAndExit;
if (ee.Rouzaneh == "ماموريت")
{
e.Row.Background = Brushes.Yellow;
}
else if (ee.ShiftID == 1 || ee.ShiftID == 2)//تعطيل رسمی و يا غير رسمی
{
e.Row.Background = Brushes.MediumSeaGreen;
}
else if (ee.Rouzaneh != null)
{
e.Row.Background = Brushes.Yellow;
}
else if (ee.Date <= DateTime.Now && ee.HasData == false)//غيبت
{
e.Row.Background = Brushes.DeepPink;
}
}
یک Collection به ِDataGrid بايند کردم و در متد LoadingRow بر اساس شرایطی رنگ Row ها رو ست کردم.
رنگها درست ست میشن اما وقتی با ScrollBar اسکرول میکنم رنگها تغيير میکنن!!!!!
private void datagrid_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.Header = (e.Row.GetIndex() + 1);
var ee = e.Row.Item as EnterAndExit;
if (ee.Rouzaneh == "ماموريت")
{
e.Row.Background = Brushes.Yellow;
}
else if (ee.ShiftID == 1 || ee.ShiftID == 2)//تعطيل رسمی و يا غير رسمی
{
e.Row.Background = Brushes.MediumSeaGreen;
}
else if (ee.Rouzaneh != null)
{
e.Row.Background = Brushes.Yellow;
}
else if (ee.Date <= DateTime.Now && ee.HasData == false)//غيبت
{
e.Row.Background = Brushes.DeepPink;
}
}