Get the current date of first day in TimeLineWorkWeek view

Hi,


I use the Scheduler control in WPF project.

My scheduler is set in TimeLineWorkWeek view type.

I would like to get the date of the first day of displayed week.

Thanks for your help !




3 Replies 1 reply marked as answer

VM Vidyalakshmi Mani Syncfusion Team December 12, 2024 12:00 PM UTC

Hi Carpenter,


Thank you for reaching out to us. To achieve your requirement, you can use the `ViewChanged` event, which is triggered whenever the scheduler view or visible dates are changed, such as when navigating forward or backward. Within this event, you can retrieve the first date of the displayed week by accessing the `StartDate` property of the `NewValue` in the event arguments. Here's a code snippet to demonstrate how you can do this:


 

<schedule:SfScheduler x:Name="schedule"

                                         ViewType="TimelineWorkWeek"

                                         ViewChanged="schedule_ViewChanged" />

 

private void schedule_ViewChanged(object sender, ViewChangedEventArgs e)

 {

     DateTime firstDate = e.NewValue.StartDate;

 }

 



For additional details, you can refer to our User Guide documentation: Events-ViewChanged


If you have any further questions or need additional assistance, please don't hesitate to contact us. We're happy to help!


Regards,

Vidyalakshmi M.



Marked as answer

TC the carpenter December 12, 2024 06:32 PM UTC

Thank you very much



VM Vidyalakshmi Mani Syncfusion Team December 13, 2024 06:27 AM UTC

Hi Carpenter,


We are glad that your issue has been resolved! Please let us know if you need further assistance. As always, we are happy to help you out.


Regards,

Vidyalakshmi M.


Loader.
Up arrow icon