Home Forums WinForms controls Xceed Grid for WinForms Row color according it’s values

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #13029 |

    Hi!
    Tell me how can I set the color of each row according the values.

    for example
    value of some column and color
    1 – red
    2 – green
    3 – blue

    so if cell of this row and column has some value I i should set the background of the row to the appropriate color.

    I have only idea to override OnPaint event. Is it right?

    Imported from legacy forums. Posted by tripolox (had 4151 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi you can put code in the ADDINGDATAROW event. This event fires every time a row is added to the grid – so you can check values in there and then color the row based upon the values.

    The current row being added is:

    e.Datarow

    Best Regards,
    FG III

    Imported from legacy forums. Posted by fgauer (had 313 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi,

    I like it but if I have a master detail grid bound to a dataset then it becomes a bit tricky to determine what’s where when it comes to determining the cell value. You have to determine whether or not a cell column might be in the row and then go from there.

    Is it possible to determine what table the data row is a part of in the dataset? I don’t know somkind of name or reference to the table itself? I’m sure it’s possible I just can’t find out where it is.

    Chris

    Imported from legacy forums. Posted by Chris (had 296 views)

    User (Old forums)
    Member
    Post count: 23064

    OK, I’m a fool.

    For anyone interested then the event happens for each detail grid as well.

    Took me ages to find that. What a clown.

    Imported from legacy forums. Posted by Chris (had 344 views)

    Odi [Xceed]
    Spectator
    Post count: 426

    I’d like to point out that if you ever get stuck like this again, please don’t hesitate to shoot off a quick email to support@xceedsoft.com with your question. They will reply back (during Xceed business hours, often very quickly) with a response that could save you a lot of time.

    I know, it would be great if support monitored the forums – we’re considering our options in this regard.

    Imported from legacy forums. Posted by Odi [Xceed] (had 406 views)

    User (Old forums)
    Member
    Post count: 23064

    It would be nice though if there was a property in the data row that you could get it’s corresponding datatable or data table name.

    Either or would do.

    Imported from legacy forums. Posted by Chris (had 5040 views)

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.