I have a question regarding the use of the business rules subsystem with a DataGrid control. I'm using Silverlight 4, C# 4, and CSLA 4.
Basically, I have an EditableChildList whose objects I'm displaying in my DataGrid. I have also added some business rules to the class as outlined in Rocky's post from April 5th, 2010 (http://www.lhotka.net/weblog/CSLA4BusinessRulesSubsystem.aspx).
If the user edits some data that causes an AddErrorResult method to execute in the business rule, then the error message appears on the DataGrid. The row with the broken rule becomes highlighted in pink, a tool tip with the error message appears for the invalid cell, and the text of the error is listed at the bottom of the grid. In my opinion this is a nice way to display error messages, all things considered.
My question is this: Is there a similar way to display information to the user when an AddWarningResult or AddInformationResult is encountered in the business rules? I've stepped through my code and verified that the appropriate context.AddWarningResult and context.AddInformationResult method calls are made in my business rules. But what next? I was hoping some similar tool tips and messages would appear on my DataGrid, but nothing at all happens. Is there a standard way to display these on the DataGrid?
The display you are seeing drives offf the INotifyDataErrorInfo interface defined by Microsoft. That interface only has the concept of validation errors. It has no concept of warning or info severities.
This isn't new really. On the .NET side there's IDataErrorInfo, which has been around from the start. That interface is used b Windows Forms and WPF to do something like you see in SL4 (though not as nice). But again, it only supports validation errors, there is no other concept of severity.
Copyright (c) Marimer LLC