MoveToPreviousView

Example

Here is an example demonstrating how to define custom command MoveToPreviousView command. First you have to create a class that inherits from the CalendarCommand class and set it's Id to CommandId.MoveToPreviousView.

public class CustomMoveToPreviousViewCommand : CalendarCommand
{
    public CustomMoveToPreviousViewCommand()
    {
        this.Id = CommandId.MoveToPreviousView;
    }

    public override bool CanExecute(object parameter)
    {
        var context = parameter as CalendarViewChangeContext;
        // put your custom logic here
        return true;
    }

    public override void Execute(object parameter)
    {
        var context = parameter as CalendarViewChangeContext;
        // put your custom logic here
    }

}

Then you can add an instance of the custom defined command class to the RadCalendar.Commands collection:

<telerik:RadCalendar>
    <telerik:RadCalendar.Commands>
        <local:CustomMoveToPreviousViewCommand/>
    </telerik:RadCalendar.Commands>
</telerik:RadCalendar>
In this article