Multiple Selection Bugs

Jan 1, 2010 at 2:00 PM
Edited Jan 1, 2010 at 2:02 PM

1. Selection is not proper after mouse up event

Please read the following steps for Multiple Selection:

1. Select the any date on a month. Let's say 2nd Feb 2010.

2. Color of selected date is changed to Orange

3. Hold down the mouse and move on the other dates. Let's say 9th Feb 2010 (just below the 2nd Feb)

4. It selects 2nd Feb and 10th Feb only instead of 2nd Feb to 10th Feb. Actually it gives the proper selection dates but it confuses the user because of the selection

Solution:

Class: SLControlLibrary.Resources.Controls.Calendar.ClassicCalendar.ucCalendar

Method: AddSelection

if (_MultiSelectionEndDate != null && _MultiSelectionStartDate != null)
                {
                    _IsMouseSelection = true;
                    SelectedDates.AddRange(_MultiSelectionStartDate.Value, _MultiSelectionEndDate.Value);

                    //Please add the below code here

Add the following code:

DateTime startDate = SelectedDates.Min();
                    DateTime endDate = SelectedDates.Max();
                    var selectedList = from item in _DayCollection
                               where item.Value >= startDate.Day && item.Value <= endDate.Day
                               select item;
                    if (selectedList != null && selectedList.Count() > 0)
                    {
                        foreach (ucDay _Day in selectedList)
                        {
                            _Day.BorderTopFill = new SolidColorBrush(Colors.Orange);
                            _Day.BorderBottomFill = new SolidColorBrush(Colors.Orange);
                            _Day.IsSelected = true;
                        }
                    }
                    
                    var unselectedList = from item in _DayCollection
                               where item.Value < startDate.Day || item.Value > endDate.Day
                               select item;
                    if (unselectedList != null && unselectedList.Count() > 0)
                    {
                        foreach (ucDay _Day in unselectedList)
                        {
                            _Day.IsSelected = false;
                        }
                    }

 

Note: We can create the method to select the days to reduce duplicate code but this is hotfix :).