Version

InvalidValueBehavior Property (ValueEditor)

Specifies what action to take when the user attempts to leave the editor with an invalid value.
Syntax
'Declaration
 
Public Property InvalidValueBehavior As InvalidValueBehavior
public InvalidValueBehavior InvalidValueBehavior {get; set;}
Remarks

InvalidValueBehavior specifies what action to take when the user tries to leave the editor after entering an invalid value.

There are various ways a value in the editor can be considered invalid by the editor. If the entered text can not be parsed into an object of type specified by ValueType property, then the value is considered invalid. For example, if the ValueType is set to Int32 or any other numeric type and the user enteres a non-numeric text then the text can not be parsed into the value type. As a result the editor will consider the input invalid.

Another way the value can be considered invalid is if the entered value can not satisfy constraints specified by ValueConstraint object. For example, if MinInclusive is specified as 10 and the value entered is 8 then the value does not satisfy the constraints and thus will be considred invalid.

Example
The following code sets InvalidValueBehavior to DisplayErrorMessage and RevertValue on textEditor3 and textEditor4 respectively. The textEditor3 will validate the user input to make sure that the length is at least 4 characters. The textEditor4 will validate the user input to make sure that it can be parsed to Int32. The action taken when the user attempts to leave the editor after entering invalid value depends on the InvalidValueBehavior property setting.

<!--This editor will make sure that the text entered is at least 4 characters long-->
<igEditors:XamTextEditor x:Name="textEditor3" InvalidValueBehavior="DisplayErrorMessage" >
    
<igEditors:XamTextEditor.ValueConstraint>
        
<igEditors:ValueConstraint MinLength="4" />
    
</igEditors:XamTextEditor.ValueConstraint>
</igEditors:XamTextEditor>

<!--This editor will validate the value to make sure it's of Int32 type-->
<igEditors:XamTextEditor x:Name="textEditor4" InvalidValueBehavior="RevertValue" ValueType="{x:Type system:Int32}" />
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also