Home Forums WinForms controls Xceed Grid for WinForms How can I change the DataType after column is created?

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

    I want to change the DataType for a column after the column already exists.  The DataType is a read-only property so I can’t see how to do this.  I’m not even sure it’s possible.  Anyone know how to do this?

     A related question: Does setting the DataType control the formatting of the data or do I still have to “pre-format” the data before inserting it into the grid?

     In case someone asks why I would want to set the DataType after the column is created:  I have a number of grids I’m using.  I create the grids by calling a function in a class with a list of the names of the columns but at that point the program doesn’t know what type the data is.  Later, when the grid is populated is when I know the types.  I just left all the fields as strings and formatted them myself but it appears the SummaryRow Sum function won’t work unless the DataType is set.  So I’m back try to set the DataType correctly.

     Responses are much appreciated!

    Mike

    Imported from legacy forums. Posted by Mike (had 1662 views)

    Xceed Support
    Member
    Post count: 5658

    Hi Mike,

    You cannot change the DataType of an Xceed Column. A possible workaround is to delete the column you want to change and then recreate it with the desired dataType before adding it to the Columns collection of your GridControl instance.

    The display of the field value is handled by the CellViewerManager whereas the editing is taken care by the CellEditorManager. Default types will have automatically the proper editor and viewer: for instance a string will be displayed as a TextBlock and be editable via a TextEditor.

    For user defined type, it is your responsibility to provide the appropriate manager classes. Moreover, you might need to refresh your grid after doing the process.

     

    Imported from legacy forums. Posted by Mohamed [Xceed] (had 392 views)

    User (Old forums)
    Member
    Post count: 23064

    I appreciate the response.  I can stop looking for something that isn’t there.  THe delete/recreate the column might work but I think I’ll just work on a redesign that allows me to know the format type prior to the column creation.

    Thanks for the additional information about CellViewerManager and CellEditorManager.

    Mike

    Imported from legacy forums. Posted by Mike (had 1194 views)

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