Skip to main content
.NET Framework 4.6.2+

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

RuleBaseAttribute.InvertResult Property

Specifies whether the current rule should be inverted, to be checked.

Namespace: DevExpress.Persistent.Validation

Assembly: DevExpress.Persistent.Base.v24.2.dll

#Declaration

public bool InvertResult { get; set; }

#Property Value

Type Description
Boolean

true, if an inverted rule will be checked; otherwise, false.

#Remarks

When defining a rule, you can specify its inverted behavior. When it is inverted, the rule will be satisfied under the conditions that are opposite to those when not inverted. For instance, while a RuleRange rule is satisfied when the target value is within a specified range, the same, but inverted rule will be satisfied when the target value is out of this range. To set the inverted behavior for a rule that is defined via a validation attribute, use the named InvertResult parameter.

[RuleRange("",DefaultContexts.Save, 45,35,InvertResult=true)]
public double Amount {
   //...
}

By default, InvertResult is set to false.

The inverted behavior specified for a validation rule in code is set for the InvertResult property of the IModelRuleBase node. So, you can change this behavior directly in the Application Model.

Note

When setting InvertResult to true, specify the RuleBaseAttribute.CustomMessageTemplate property. This is required, because default message templates are oriented on the false value of the InvertedREsult property.

#Implements

See Also