locked
Can sorting a datagrid with validation rules ? RRS feed

  • Question

  • hi,
    I have a datagrid with validation rules.
    But I can not sort the grid on a column that contains a validation rule

    Is it possible to sort a datagrid that contains validation rules?

    Thanks.

    Thursday, October 24, 2013 8:04 AM

Answers

  • You cannot sort the grid when a validation rule has failed. This is because when a ValidationRule fails, the row or cell of the DataGrid is kept in edit mode (the IsEditing property returns true) and trying to sort during an AddNew or EditItem transaction will cause an InvalidOperationException to be thrown.

    Thursday, October 24, 2013 11:00 AM

All replies

  • You cannot sort the grid when a validation rule has failed. This is because when a ValidationRule fails, the row or cell of the DataGrid is kept in edit mode (the IsEditing property returns true) and trying to sort during an AddNew or EditItem transaction will cause an InvalidOperationException to be thrown.

    Thursday, October 24, 2013 11:00 AM
  • I also think the SortMemberPath attribute may be defined when using DataGridTemplateColumn.

    Let's give a try.

    Thursday, October 24, 2013 11:15 AM