Category / Section
How to get date and appointment details while tapping view header ?
1 min read
In SfSchedule, you can get the selected date details in view header of Schedule using ViewHeaderTapped event which will be fired while tapping date in the view header panel.
XAML
<syncfusion:SfSchedule x:Name="schedule" ScheduleView="WeekView" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" > </syncfusion:SfSchedule>
In ViewHeaderTapped, DateTime of the selected date in the view header panel will be known. Selected date time will be known for all the schedule views. In month view, the dates in the first row (row immediate below the view header) will be known in the DateTime parameter in the event.
C#
schedule.ViewHeaderTapped += Schedule_ViewHeaderTapped; void Schedule_ViewHeaderTapped(object sender, ViewHeaderTappedEventArgs e) { //date of the selected item. var dateTime = e.DateTime; DisplayAlert("SelectedDate",e.DateTime.Day.ToString(),"Ok"); }
You can also switch schedule views by setting the required ScheduleView type in the ViewHeaderTapped event.
You can download the source code for entire demo of switching schedule view through event from here, ScheduleSample.