Home › Forums › WinForms controls › Xceed Grid for WinForms › Getting color value of row
-
AuthorPosts
-
#14582 |
I have some data that is being searched, and as I find it, I set the backcolor. When I research, I want to verify the color of the row Im on, and if its the already searched color, I want to reset it to another color.
So what I have is 3 colors. Default backcolor, currently searched color, already found color.
I load the grid, start my search, if the item is found, I set the row backcolor to green. My second search goes thru, it finds the green background (different item searched) and I set the backcolor to blue.
Hope that was clear.
Imported from legacy forums. Posted by Christopher (had 4397 views)
Your explanation is clear, your question is not! What is it that you want to know? You can do this using the row or cell BackColor property and ResetBackColor() method.
Imported from legacy forums. Posted by André (had 415 views)
I figured it was a bit cryptic.
I need to know what the background color is for the current row.
Imported from legacy forums. Posted by Christopher (had 349 views)
Use gridControl1.CurrentRow.GetDisplayBackColor().Name;
The GetDisplayBackColor() method is available on any GridElement, thus you can use it on DataRows[ index ] or SelectedRows[ index] too.
Imported from legacy forums. Posted by André (had 434 views)
Ok, now how do I compare it against a color? – This is the part Im having issues with.
Imported from legacy forums. Posted by Christopher (had 327 views)
Do something like this :
if( gridControl1.CurrentRow.GetDisplayBackColor() == Color.Chocolate )
{
System.Diagnostics.Debug.WriteLine( “Same color” );
}
else
{
System.Diagnostics.Debug.WriteLine( “Different color” );
}Imported from legacy forums. Posted by André (had 316 views)
Ill try that, thanks.
Imported from legacy forums. Posted by Christopher (had 5426 views)
-
AuthorPosts
- You must be logged in to reply to this topic.