Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
185
Different Field Types in same column.
posted

Hi

Is it possible to have have different field types in the same grid column?
So for example column 1 row 1 I need a numeric entry (using the XamNumericEditor as the EditorStyle) and column 1 row 2 I need a DateTime field (using  the XamDateTimeEditor as the EditorStyle)

The problem seems to be when setting the Field.EditAsType property, if it's changed to "typeof(decimal)" then it'll clear all values in the column which can't be converted to decimal so my entered DateTime values in that row get cleared.

Any ideas?

Rgds

M

 

 

 

  • 69686
    Verified Answer
    posted

    Hello,

    The XamDataGrid will generate by default editors of the same type for the whole field's cells. So, if you have set the EditAsType, EditorStyle or EditorType properties you explicitly set the type of editor that will be used for that field. One thing that you can do go achieve what you want is to use the InitializeRecord event. This will fire for all the records and you can change the Editor settings through the cell instance, like this:

    (e.Record as DataRecord).Cells[0]...

    Let me know if you have questions on this. If you still have troubles, I will be happy to attach a sample project illustrating this.

  • 1100
    Suggested Answer
    posted

    Just a random thought (and I am by no means an expert here)... I wonder if some hidden data in any given row could specify a EditorType to use and then you could bind the actual field EditorType to that data.

    Thanks.