Home Forums WinForms controls Xceed Grid for WinForms Displaying null values from databound sources

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

    Hi All,

    I am trying to display a databound IList containing objects (multiple properties, some of them nullable) and the grid displays for null values a crossed cell. Is there any way I can alter this behavior. I tried with CellViewManagers but strangely the methods in them are not called for cells having nulls. I tried with Cell.NullText property to setup a meaningful value to be displayed to no avail. Please help!

    Imported from legacy forums. Posted by Eugen (had 1885 views)

    User (Old forums)
    Member
    Post count: 23064

    I figured it out. This is not about null values. My mistake.

    The problem was that Xceed grid in the process of painting a databound cell queries the bound datasource for its value. Now, for a source such as DataTable a DBNull value translates in a TargetInvocationException when read.
    The fix consisted in replacing the CellViewManagers with a custom ViewManager which paints the cell differently for the cells bound to a source throwing an exception. This is done by providing a Paint handler which is invoked after the classe’s base Paintbackground() and PaintForeground() have been called so that is the last paint done on the cell.

    Imported from legacy forums. Posted by Eugen (had 2993 views)

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