Category / Section
How to display a particular day and time in day view of WPF Scheduler (Calendar)
4 mins read
You can configure the day view as per your requirements in WPF SfScheduler .
XAML
You can avoid the vertical scrolling by setting the StartHour and EndHour properties of DayViewSettings. By setting TimeIntervalHeight to -1, you can view the scheduler in full screen.
<Window.DataContext> <local:SchedulerViewModel/> </Window.DataContext> <Grid> <syncfusion:SfScheduler x:Name="Schedule" ViewType="Day" ItemsSource="{Binding Meetings}"> <syncfusion:SfScheduler.AppointmentMapping> <syncfusion:AppointmentMapping StartTime="From" EndTime="To" Subject="EventName" AppointmentBackground="Color" IsAllDay="IsAllDay"/> </syncfusion:SfScheduler.AppointmentMapping> <syncfusion:SfScheduler.DaysViewSettings> <syncfusion:DaysViewSettings StartHour="11" EndHour="20" TimeIntervalHeight="-1"> </syncfusion:DaysViewSettings> </syncfusion:SfScheduler.DaysViewSettings> <interactivity:Interaction.Behaviors> <local:SchedulerBehavior/> </interactivity:Interaction.Behaviors> </syncfusion:SfScheduler> </Grid>
C#
You can disable the navigation by setting the MinimumDate and MaximumDate properties of the schedule. By setting DisplayDate property in the schedule, you can move to the specific date in schedule.
public class SchedulerBehavior : Behavior<SfScheduler> { SfScheduler scheduler; protected override void OnAttached() { base.OnAttached(); scheduler = this.AssociatedObject; this.AssociatedObject.DisplayDate = DateTime.Now.Date.AddHours(11); this.AssociatedObject.MinimumDate = DateTime.Now.Date; this.AssociatedObject.MaximumDate = DateTime.Now.Date; } protected override void OnDetaching() { base.OnDetaching(); this.scheduler = null; } }