How to navigate to the specific month in WPF Scheduler (Calendar)
Visible dates can be moved to specific date using the DisplayDate property available in SfScheduler. It is applicable for all the SchedulerViewType in WPF SfScheduler
C#
Create a ViewModel class and add a DisplayDate property with specific date.
public class SchedulerViewModel : INotifyPropertyChanged
{
private DateTime displaydate = new DateTime(2020, 11, 10, 10, 0, 0);
public DateTime DisplayDate
{
get
{
return this.displaydate;
}
set
{
this.displaydate = value;
this.RaiseOnPropertyChanged("DisplayDate");
}
}
}
C#
Create a custom class Meeting with mandatory fields From, To, EventName and color.
public class Meeting
{
public string EventName { get; set; }
public DateTime From { get; set; }
public DateTime To { get; set; }
public Brush color { get; set; }
}
XAML
Bind the displaydate ViewModel property to the DisplayDate property of SfScheduler.
<Window.DataContext>
<local:SchedulerViewModel />
</Window.DataContext>
<Grid>
<syncfusion:SfScheduler
x:Name="Schedule"
ViewType="Month"
ItemsSource="{Binding Meetings}"
DisplayDate="{Binding DisplayDate}">
<syncfusion:SfScheduler.AppointmentMapping>
<syncfusion:AppointmentMapping
StartTime="From"
EndTime="To"
AppointmentBackground="color"
Subject="EventName">
</syncfusion:AppointmentMapping>
</syncfusion:SfScheduler.AppointmentMapping>
</syncfusion:SfScheduler>
</Grid>
Output
