This is a migrated thread and some comments may be shown as answers.

MonthChanged Event?

2 Answers 35 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Matt
Top achievements
Rank 1
Matt asked on 19 Jan 2015, 02:29 AM
Is there an event that I can tie into when the month is changed? I would like to select the first date of the new month so that any detailed appointment data below is not still from a previous selection.

I've tried subscribing to SelectionChanged as the example shows, but that is not triggered unless a new date is actually tapped.

Thanks.

2 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 22 Jan 2015, 09:09 AM
Hi Matt,

You can take advantage of the commands in RadCalendar. Specifically, MoveToPreviousView and MoveToNextView should do the trick for your. Here is a sample implementation for MoveToPreviousView:

public class CustomMoveToPreviousViewCommand : CalendarCommand
{
    public CustomMoveToPreviousViewCommand()
    {
        this.Id = CommandId.MoveToPreviousView;
    }
 
    public override bool CanExecute(object parameter)
    {
        return true;
    }
 
    public override void Execute(object parameter)
    {
        var context = parameter as CalendarViewChangeContext;
        this.Owner.CommandService.ExecuteDefaultCommand(this.Id, parameter);
 
        // Check this.Owner.DisplayDate here
    }
}

The value of this.Owner.DisplayDate will reflect the navigation and will hold a date from the month being shown.

Best regards,
Ves
Telerik

0
Matt
Top achievements
Rank 1
answered on 26 Jan 2015, 02:10 AM
Works great, thank you!
Tags
Calendar
Asked by
Matt
Top achievements
Rank 1
Answers by
Ves
Telerik team
Matt
Top achievements
Rank 1
Share this question
or