Hi,
I have a Datagrid with a DateTime field in it. By Default I get the XamDateTimeEditor to edit the Value of the Field.
Is it possible to set a minimun and maximum Date like in the XamMonthCalendar. (Disabled Date Ranges)
Or do you know an workarround how to limit the selection. Maybe something like using the MonthCalendar and styling it like the DateTimeEditor...
Yours sincrealy
Thomas
Hello Thomas,
The XamDateTimeEditor uses internally the month calendar when it is in edit mode. The ValueEditors have ValueConstraints which you can use to sex min - max range of the dates. Here is some sample code for doing so:
Style s = new Style(typeof(XamDateTimeEditor));
ValueConstraint constraint = new ValueConstraint();
constraint.MaxInclusive = new DateTime(2009, 10, 15);
constraint.MinExclusive = new DateTime(2009, 10, 1);
Setter st = new Setter(XamDateTimeEditor.ValueConstraintProperty, constraint);
s.Setters.Add(st);
Thank you for your help.
The Code you send me doesn't work for me. However, you helped me getting on the right way. Now I have an solution in the xaml that works for me:
<igDP:Field Name="RB_Date" Label="Datum"> <igDP:Field.Settings> <igDP:FieldSettings EditorType="{x:Type igDE:XamDateTimeEditor}"> <igDP:FieldSettings.EditorStyle> <Style TargetType="{x:Type igDE:ValueEditor}"> <Style.Setters> <Setter Property="ValueConstraint"> <Setter.Value> <igDE:ValueConstraint MinInclusive="01.10.2009" MaxInclusive="01.11.2009" /> </Setter.Value> </Setter> </Style.Setters> </Style> </igDP:FieldSettings.EditorStyle> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field>