Unplanned
Last Updated: 25 Dec 2020 13:39 by ADMIN
Nicklas
Created on: 25 Dec 2020 13:26
Category: Calendar
Type: Feature Request
0
RadCalendar: provide an opportunity to disable the drag-drop selection when AllowMultipleSelect=true
Currently, when AllowMultipleSelect= true the dragging selection is always enabled. 
1 comment
ADMIN
Nadya | Tech Support Engineer
Posted on: 25 Dec 2020 13:39

Hello, Nicklas,

Currently, you can use the following code snippet to disable the drag selection:

 public RadForm1()
 {
     InitializeComponent();

     this.radCalendar1.AllowMultipleSelect = true;
     this.radCalendar1.SelectionChanging += this.RadCalendar1_SelectionChanging;
     this.radCalendar1.MouseDown += this.RadCalendar1_MouseDown;
     this.radCalendar1.MouseUp += this.RadCalendar1_MouseUp;
 }

 CalendarCellElement cellSelectionStart;
 bool isMouseDown;
 private void RadCalendar1_MouseUp(object sender, MouseEventArgs e)
 {
     this.cellSelectionStart = null;
     this.isMouseDown = false;
 }

 private void RadCalendar1_MouseDown(object sender, MouseEventArgs e)
 {
     CalendarCellElement cell = this.radCalendar1.ElementTree.GetElementAtPoint<CalendarCellElement>(e.Location);
     if (cell != null)
     {
         this.cellSelectionStart = cell;
         this.isMouseDown = true;
     }
 }
 private void RadCalendar1_SelectionChanging(object sender, SelectionEventArgs e)
 {
     if (this.isMouseDown && e.NewDates.Count > 0)
     {

         var dates = e.NewDates.Where(d => d.Date != this.cellSelectionStart.Date);
         if (dates.Count() > 0)
         {
             e.Cancel = true;
         }
     }
 }

I hope this helps. 

Regards,
Nadya
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.