I have a XamDataGrid where I use the XamDateTimeInput as EditTemplate for a TemplateField.I don't use the default DateTimeField, because I think the Calendar of it is pretty ugly and wasn't able to change the it's Template to the one of the XamDateTimeInput.
I now have the problem, that I have a List of Dates that only shall be selectable, and have gaps between them. For example 14.08.2018 till 16.08.2018, 21.08.2018 and so on. Because of that MaxValue and MnValue aren't enough.I have tried to use the ValueConstraint Enumeration, what threws an exception at the confirmation of the Value but I can still select the Date in the Calendar and so on.
<igDP:TemplateField.EditTemplate> <DataTemplate> <ig:XamDateTimeInput Value="{igEditors:TemplateEditorValueBinding}" > <ig:XamDateTimeInput.ValueConstraint> <ig:ValueConstraint Enumeration="{Binding Source={StaticResource enum}, Path=MyEnum}"/> </ig:XamDateTimeInput.ValueConstraint> </ig:XamDateTimeInput> </DataTemplate> </igDP:TemplateField.EditTemplate>
Back with the XamDateTimeEditor I had the same problem, I tried to solve with the following code. But the loop takes extremely long.
private void XamDateTimeEditor_DropDownOpened(object sender, RoutedEventArgs e) { XamMonthCalendar xamMonthCalendar = Infragistics.Windows.Utilities.GetTemplateChild<XamMonthCalendar>((XamDateTimeEditor)sender); xamMonthCalendar.DisabledDaysOfWeek = Infragistics.Controls.DayOfWeekFlags.Sunday; xamMonthCalendar.MinDate = DateTime.Today; DataTable dt = Daten.GibNotAllowedDates(GlobaleVariablen.selGruppe); foreach (DataRow dr in dt.Rows) { Infragistics.Windows.Editors.CalendarDateRange calendarDateRange = new Infragistics.Windows.Editors.CalendarDateRange((DateTime)dr["Datum"]); xamMonthCalendar.DisabledDates.Add(calendarDateRange); } }