Home / Blog / Restricting date values of the Infragistics WPF XamDateTimeEditor
Restricting date values of the Infragistics WPF XamDateTimeEditor

Restricting date values of the Infragistics WPF XamDateTimeEditor

The infragistics WPF XamDateTimeEditor allows by default the input of all date values. This is not useful for most LOB applications.

It is possible to restrict the input with a style:

<Style x:Key="xamDateTimeLimitedEditorStyle" TargetType="{x:Type igEditors:XamDateTimeEditor}">
<Style.Setters>
<Setter Property="ValueConstraint">
<Setter.Value>
<igEditors:ValueConstraint MinInclusive="01/01/2000" MaxExclusive="01/01/2100" />
</Setter.Value>
</Setter>
</Style.Setters>
</Style>

Or inline in the XAML:

<editors:XamDateTimeEditor>
<editors:XamDateTimeEditor.ValueConstraint>
<editors:ValueConstraint MinInclusive="01/01/2000" MaxExclusive="01/01/2100" />
</editors:XamDateTimeEditor.ValueConstraint>
</editors:XamDateTimeEditor>

Contact