How to collapse the built-in editors in appointment editor window in WinUI Scheduler (Calendar)
In the WinUI Scheduler, it is possible to collapse the editors in the scheduler built-in appointment editor window pragmatically with the help of the AppointmentEditorOpening event. By the default appointment, all the details of the editors will be displayed in the scheduler appointment editor window.
C#
Using the AppointmentEditorOpening event, set the value for the AppointmentEditorOptions property of the editors that need to be collapsed or be visible pragmatically in the SchedulerAppointmentEditorWindow. Here, we have collapse the Background and Foreground editors in the SchedulerAppointmentEditorWindow.
private void OnAppointmentEditorOpening(object sender, AppointmentEditorOpeningEventArgs e) { e.AppointmentEditorOptions = AppointmentEditorOptions.All | (~AppointmentEditorOptions.Background & ~AppointmentEditorOptions.Foreground); }
The basic editors such as Subject, Location, Start Hour, and End Hour of the scheduler appointment editor will not be collapsed.
C#
Create a collection of Events for the Scheduler.
public SchedulerViewModel() { this.Events = new ScheduleAppointmentCollection(); var scheduleAppointment = new ScheduleAppointment() { StartTime = DateTime.Now, EndTime = DateTime.Now.AddHours(1), AppointmentBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF339933")), Subject = "Conference", }; Events.Add(scheduleAppointment); }
XAML
Bind the appointments from the view model to a schedule by using the ItemsSource property.
<Grid> <Grid.DataContext> <local:SchedulerViewModel/> </Grid.DataContext> <syncfusion:SfScheduler x:Name="scheduler" ViewType="Month" ItemsSource="{Binding Events}" > </syncfusion:SfScheduler> </Grid>
Take a moment to pursue the documentation. You can also find the options available for the collapse of the built-in appointment editor window in the Schedule.