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
305
Showing Errors Properly
posted

I want to do the following:

  • When a user is in the new row editor, do not show any errors (i.e. the usual editing experience)
  • When the row gets added, show the error for each cell in error (e.g. the red border). I have seen this happen for ItemTemplate/TextBlock with EditorTemplate/TextBox, but have not seen it happen for other cells such as EditorTemplate/XamComboEdit.
  • When the row is a Normal row, but is not being edited and is not selected, change the background color of the error'd cells (I've seen this work sporadically)
  • When the Row is an Alternate row, do the same (I've tried various row event handlers, but alternate formatting seems to quash this.
  • When the normal or alternate row is selected, show it to be similar to the normal or alternate row (e.g. with errors) but where the selection is semi-transparent (e.g. so you can still see the error styles).

The goal is that once an error is detected, it is visible in the row, regardless of the row's visual states (selected/notselected; active/notactive; normal/mouseover/alternate) etc.

I have tried creating a conditional formatter (but it seems to be applied before alternate row stylings) I have tried various events such as RowAdded, ItemControlAttached, etc. but sometimes don't have a populated model. I have tried INotifyDataErrorInfo, but this only works on rows that are being edited.

Is there a complete sample somewhere that demonstrates all of these requirements or is there a "final" event for a row which gives 1) the fully populated Row.Data object and 2) occurs after all other events, allowing me to specify an error style?

  • 40030
    Offline posted

    Hello, 

    AlternateRowStyling is simply a VisualState in the CellControl. 

    I think ConditionalFormatting is your best bet still. 

    We offer an additional property on a ConditionalFormattingCellControl, called AltBackground, which you can set to be the same as your background. 

    You can also turn off AlternatingRows altogether if you don't want  them at all via the IsAlternateRowEnabled property on the xamGrid. 

    Hope this helps, 

    -SteveZ