Completed
Last Updated: 15 Aug 2017 11:03 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 26 May 2017 11:12
Category: Calendar
Type: Bug Report
1
FIX. RadCalendar - selected cells are cleared when you click the row header to select the entire row
To reproduce: use the following code snippet:

            radCalendar1.AllowMultipleSelect = true;
            radCalendar1.ShowRowHeaders = true;
            radCalendar1.AllowRowHeaderSelectors = true;
 If you select several cells, they all are selected. Then, click the header row cell. You will notice that the cells from this row are selected but all previously selected cells are cleared. The attached gif file illustrates the behavior. 

Workaround: use the MouseDown event to store the currently selected cells and then on MouseUp restore the missing selection:

public class MyCalendar : RadCalendar
{
    List<DateTime> selectedDays = new List<DateTime>();

    protected override void OnMouseDown(MouseEventArgs e)
    {
        CalendarCellElement cell = this.ElementTree.GetElementAtPoint(e.Location) as CalendarCellElement;
        if (cell != null)
        {
            bool isHeader = (bool)cell.GetValue(CalendarCellElement.IsHeaderCellProperty);
            if (isHeader)
            {
                selectedDays.Clear();
                foreach (DateTime date in this.SelectedDates)
                {
                    selectedDays.Add(date);
                }
            }
        }
        base.OnMouseDown(e);
    }

    protected override void OnMouseUp(MouseEventArgs e)
    {
        base.OnMouseUp(e);
        foreach (DateTime date in selectedDays)
        {
            if (!this.SelectedDates.Contains(date))
            {
                this.SelectedDates.Add(date);
            }
        }
    }

    public override string ThemeClassName  
    { 
        get 
        { 
            return typeof(RadCalendar).FullName;  
        }
    }
}
0 comments