Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
580
How to prohibits the continual selection when there is a invalid date in mode "Range"
posted

In SelectType=Range mode, the selected dates should be continuous rather than continual

when there is a unselelctable date,How to prohibits the  continual selection.

4/4  4/5  4/7  4/8  are invalid dates.

What  I need is :

if my mousedown start at 4/1  and  stop at 4/4 , the selected collection should be{4/1, 4/2, 4/3 }

if my mousedown start at 4/1  and  stop at 4/6 , the selected collection should be{4/1, 4/2, 4/3 }, and 4/6 shouldn't be display with a selected status.

if my mousedown start at 4/1  and  stop at 4/19 , the selected collection should be{4/1, 4/2, 4/3 }, and 4/6,4/9~4/19 shouldn't be display with a selected status.

How to do it.

 

 

Parents
No Data
Reply
  • 17559
    Verified Answer
    posted

    Hello user12341234,

    I have been looking into your issue and in order to change the default behavior I can suggest you handle the SelectedDatesChanged event as follows:

            private void xamMonthCalendar1_SelectedDatesChanged(object sender, Infragistics.Windows.Editors.Events.SelectedDatesChangedEventArgs e)
            {
                
               for(int i=0;i<xamMonthCalendar1.SelectedDates.Count-1;i++)
                   if (xamMonthCalendar1.SelectedDates[i + 1]- xamMonthCalendar1.SelectedDates[i] > new TimeSpan(1,0,0,0))
                   {
                       for (int j = i + 1; j < xamMonthCalendar1.SelectedDates.Count;j++ )
                           xamMonthCalendar1.SelectedDates.RemoveAt(j);
                       
                       break;
                   }
            }
    

     

     

    This way you can check if between the current select dates there is an interval longer than one day with not presented dates, and if there is – the code will remove all of the selected dates after the disabled time span. 

    If you need any additional assistance on this matter, please feel free to ask.

Children