This is about this method:
public void SetError(GridViewCellCancelEventArgs e, Exception exception)
{
GridViewDataErrorEventArgs args = new GridViewDataErrorEventArgs(exception, 0, 0, GridViewDataErrorContexts.Commit);
if (e != null)
{
args = new GridViewDataErrorEventArgs(exception, e.ColumnIndex, e.RowIndex, GridViewDataErrorContexts.Commit);
}
this.EventDispatcher.RaiseEvent<GridViewDataErrorEventArgs>(EventDispatcher.DataError, this, args);
if (args.ThrowException)
{
throw args.Exception;
}
if (args.Cancel)
{
//TODO: cancel row edit
}
}
The method GridViewTemplate.SetError accepts a parameter of type GridViewCellCancelEventArgs (named e), but uses the information to create a new object of type GridViewDataErrorEventArgs (named args) and uses information from e to fill args.
The method then fires an event with args. Args also has a property Cancel which can be set in the event handlers. But nothing is done with that property.
Parameter e also has a property Cancel which is never be filled. So it could be useful, at the end of SetError, to set e.Cancel with args.Cancel. This way the caller can use the Cancel information from the events.
This request is also related to my next request.
PS: Why is GridViewCellCancelEventArgs called this way? It implies it has arguments for an event, but it is not used for an event, am I right?