1
Vote

'Locked' property (of class 'CalendarItem') not working in 'Calendar' control

description

The 'CalendarItem' class has a 'Locked' property (see below) but it doesn't work in the 'Calendar' control. So when 'CalendarItems' are displayed in a 'Calendar' control, locked items can be dragged and dropped all the same. See the fix below the property.
 
    /// <summary>
    /// Gets a value indicating if this item is locked.
    /// </summary>
    /// <remarks>
    /// When an item is locked, the user can't drag it or change it's text
    /// </remarks>
    public bool Locked
    {
        get { return _locked; }
        set { _locked = value; }
    }
 
 
Fix:
 
in the function 'OnMouseMove(MouseEventArgs e)' of the class 'Calendar',
in switch-cases:
1. 'case CalendarState.DraggingItem:' and...
2. 'case CalendarState.ResizingItem:'
surround the code with (leaving the 'break' sentence outside the 'if'):
 
                    if (!itemOnState.Locked)
                    {
                        // original code here
                    }
                    break;

comments