protected override object OnCoerceValueChanged( object baseValue )
{
// Propagate error from DescriptorPropertyDefinitionBase to PropertyItem.Value
// to see the red error rectangle in the propertyGrid.
BindingExpression be = GetBindingExpression( PropertyItem.ValueProperty );
if( ( be != null ) && be.DataItem is DescriptorPropertyDefinitionBase )
{
DescriptorPropertyDefinitionBase descriptor = be.DataItem as DescriptorPropertyDefinitionBase;
if( Validation.GetHasError( descriptor ) )
{
ReadOnlyObservableCollection<ValidationError> errors = Validation.GetErrors( descriptor );
Validation.MarkInvalid( be, errors[ 0 ] );
}
}
return baseValue;
}