Im want to display error message to UI when user change the quantity of package entry.
Im firgured out has a way to validate data of CatalogRelationDto by using ICatalogEvents like this:
public void Initialize(InitializationEngine context)
var catalogEvent = ServiceLocator.Current.GetInstance<ICatalogEvents>();
catalogEvent.RelationUpdating += CatalogEvent_RelationUpdating;
private void CatalogEvent_RelationUpdating(object sender, RelationEventArgs e)
if (sender is CatalogRelationDto)
// TODO: Validate data
// TODO: Show error message
But currently im have no idear to show error message to UI like IValidate behavior.
Does any one have some idear?
I don't think you can use IValidate here, but throwing an exception would halt the operation. maybe not as nice as a warning, but should still work
var dto = sender as CatalogRelationDto;
if (dto.CatalogEntryRelation.Any(x => x.RowState != System.Data.DataRowState.Unchanged))
throw new InvalidOperationException("this can be done");
would show this
For request Add Package Entries (variants or packages), it worked if we throw exception from ICatalogEvents, but not for delete/update request.
I don't know the difference.