diff --git a/Radzen.Blazor/RadzenScheduler.razor.cs b/Radzen.Blazor/RadzenScheduler.razor.cs index a87163b65c1..694c4201c73 100644 --- a/Radzen.Blazor/RadzenScheduler.razor.cs +++ b/Radzen.Blazor/RadzenScheduler.razor.cs @@ -152,6 +152,24 @@ public partial class RadzenScheduler : RadzenComponent, IScheduler [Parameter] public EventCallback SlotSelect { get; set; } + /// + /// A callback that will be invoked when the user clicks the Today button. + /// + /// + /// + /// <RadzenScheduler Data=@appointments TodaySelect=@OnTodaySelect> + /// </RadzenScheduler> + /// @code { + /// void OnTodaySelect(SchedulerTodaySelectEventArgs args) + /// { + /// args.Today = DateTime.Today.AddDays(1); + /// } + /// } + /// + /// + [Parameter] + public EventCallback TodaySelect { get; set; } + /// /// A callback that will be invoked when the user clicks an appointment in the current view. Commonly used to edit existing appointments. /// @@ -422,7 +440,11 @@ async Task OnPrev() async Task OnToday() { - CurrentDate = DateTime.Now.Date; + var args = new SchedulerTodaySelectEventArgs { Today = DateTime.Now.Date }; + + await TodaySelect.InvokeAsync(args); + + CurrentDate = args.Today; await InvokeLoadData(); } diff --git a/Radzen.Blazor/SchedulerTodaySelectEventArgs.cs b/Radzen.Blazor/SchedulerTodaySelectEventArgs.cs new file mode 100644 index 00000000000..1ffde4cbc02 --- /dev/null +++ b/Radzen.Blazor/SchedulerTodaySelectEventArgs.cs @@ -0,0 +1,16 @@ +using System; +using Radzen.Blazor; + +namespace Radzen +{ + /// + /// Supplies information about a event that is being raised. + /// + public class SchedulerTodaySelectEventArgs + { + /// + /// Today's date. You can change this value to navigate to a different date. + /// + public DateTime Today { get; set; } + } +} \ No newline at end of file