Completed
Last Updated: 10 Apr 2014 11:06 by ADMIN
ADMIN
Georgi I. Georgiev
Created on: 05 Dec 2013 07:16
Category: Scheduler/Reminder
Type: Bug Report
0
RadScheduler - Showing ContextMenu with one item in the ContextMenuShowing event causes argument out of range exception
To reproduce:
Subscribe for the ContextMenuShowing event of RadScheduler and use the following code:
private void radScheduler1_ContextMenuShowing(object sender, SchedulerContextMenuShowingEventArgs e)
{
   e.ContextMenu.Items.Clear();
   e.ContextMenu.Items.Add(new RadMenuItem("Item"));
}

Right-Click on two appointments and you will notice the exception

Workaround:
Add three invisible items:
private void radScheduler1_ContextMenuShowing(object sender, SchedulerContextMenuShowingEventArgs e)
{
   e.ContextMenu.Items.Clear();
   e.ContextMenu.Items.Add(new RadMenuItem("Item"));
   for (int i = 0; i < 3; i++)
   {
       e.ContextMenu.Items.Add(new RadMenuItem() { Visibility = ElementVisibility.Collapsed });
   }
}
0 comments