Home Forums WPF controls Xceed DataGrid for WPF Cell Formatting

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

    I have a data grid that has it’s item source bound in the code behind to a custom object. Within the custom object it contains a collection of validation results listing all the columns/fields that are in error.

    What I want to do is when the data grid is loaded/presented the cells that contain validation errors should be colored. Initially I tried to handle the loaded event of the data grid control but unfortunately the grid has not been virtualized. I looked at the alternating data row styles example to see if this example could be modified to fit my needs but was unable to get it to work.

    Any assistance/advice would be greatly appreciated.

    Imported from legacy forums. Posted by Jason (had 651 views)

    Xceed Support
    Member
    Post count: 5658

    Normally, the way to act on the content of one of the field in the Data Item is to place triggers for the item in question…

    You could create a style for DataCell in which you create DataTriggers (or MultiDataTriggers) that resolve your particular “field” in your collection of validation results…

    I cannot help you really more than that, given that I don’t know the particular details of your implementation…

    Imported from legacy forums. Posted by Marcus [Xceed] (had 251 views)

    User (Old forums)
    Member
    Post count: 23064

    Taking a guess here…if you’re saying you have a collection of custom objects with pre-existing validation rules and errors…

    If your custom object is using WPF “ValidationRules” you may need to transfer them to the Xceed Column CellValidationRules collection as “CellValidationRules”.

    After doing this maybe you could force the validation on each row before displaying the grid, not sure what Xceed datagrid would do if you load a bunch of invalid data into it.

    Check out this link if you haven’t already:

    http://doc.xceedsoft.com/products/XceedWpfDataGrid/Validating%20Data.html

    Except from above link:

    Any validation rule created from the ValidationRule class can be reused in the grid by using a PassthroughCellValidationRule, which wraps any validation rule and exposes it as a CellValidationRule.

    Imported from legacy forums. Posted by Richard (had 3550 views)

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