Hey all
I'm trying to add a background color to a RadGridView cell. I often did it before and it always works perfectly, just in this case it's not working properly. Here you can see my code:
if (e.Column.Name == "BM")
{
foreach (string rs in BmList)
{
if (rs == e.Row.Cells["RS"].Value.ToString())
{
e.CellElement.DrawFill = true;
e.CellElement.BackColor = Color.FromArgb(238, 127, 0);
e.CellElement.NumberOfColors = 1;
}
else
{
e.CellElement.ResetValue(LightVisualElement.DrawFillProperty, ValueResetFlags.Local);
e.CellElement.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
e.CellElement.ResetValue(LightVisualElement.NumberOfColorsProperty, ValueResetFlags.Local);
}
}
}
This code is just coloring 1 cell, even if there are more in the list. The debugger says, in my list called "BmList" are 18 items. But it colors just one. So I'm wondering why its not coloring every cell. When I remove the foreach loop, it works fine. And when I use this code instead of "e.CellElement" it works as well:
e.Row.Cells["BM"].Style.BackColor = Color.FromArgb(238, 127, 0);
e.Row.Cells["BM"].Style.DrawFill = true;
e.Row.Cells["BM"].Style.CustomizeFill = true;
Does anyone know about that behaviour? Or am I doing something wrong?
I hope someone can help me
Regards,
Danilo
I'm trying to add a background color to a RadGridView cell. I often did it before and it always works perfectly, just in this case it's not working properly. Here you can see my code:
if (e.Column.Name == "BM")
{
foreach (string rs in BmList)
{
if (rs == e.Row.Cells["RS"].Value.ToString())
{
e.CellElement.DrawFill = true;
e.CellElement.BackColor = Color.FromArgb(238, 127, 0);
e.CellElement.NumberOfColors = 1;
}
else
{
e.CellElement.ResetValue(LightVisualElement.DrawFillProperty, ValueResetFlags.Local);
e.CellElement.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
e.CellElement.ResetValue(LightVisualElement.NumberOfColorsProperty, ValueResetFlags.Local);
}
}
}
This code is just coloring 1 cell, even if there are more in the list. The debugger says, in my list called "BmList" are 18 items. But it colors just one. So I'm wondering why its not coloring every cell. When I remove the foreach loop, it works fine. And when I use this code instead of "e.CellElement" it works as well:
e.Row.Cells["BM"].Style.BackColor = Color.FromArgb(238, 127, 0);
e.Row.Cells["BM"].Style.DrawFill = true;
e.Row.Cells["BM"].Style.CustomizeFill = true;
Does anyone know about that behaviour? Or am I doing something wrong?
I hope someone can help me
Regards,
Danilo