How to restrict the appointment editing operation in WPF Scheduler?
With the help of the AppointmentEditFlag property in the WPF Scheduler, it is possible to manage various types of operations. The AppointmentEditFlag property options to use the fields as Add, Edit, Resize, DragDrop and None.
The AppointmentEditFlag properties will perform the built-in operations of add, edit, Resize, and DragDrop. It will disable all the functionality when it is set as None.
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, and bind the AppointmentEditFlag Enum values as the itemsource of the ComboBox to change the AppointmentEditFlag property at a runtime.
<Window.DataContext> <local:SchedulerViewModel/> </Window.DataContext> <Grid x:Name="grid"> <syncfusion:SfScheduler x:Name="schedule" ViewType="Week" HeaderHeight="50" ItemsSource="{Binding Events}" AppointmentEditFlag="{Binding ElementName=AppointmentEditFlagComboBox, Path=SelectedValue,Mode=TwoWay}"> </syncfusion:SfScheduler> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,5,10,0"> <ComboBox x:Name="AppointmentEditFlagComboBox" SelectedIndex="1" Width="100" Height="30" /> </StackPanel> <interactivity:Interaction.Behaviors> <local:ScheduleBehavior/> </interactivity:Interaction.Behaviors> </Grid>
View sample in GitHub
Take a moment to pursue the documentation. You can also find the options available for the AppointmentEditFlag property in Schedule.
Conclusion
I hope you enjoyed learning about how to restrict the appointment editing (CRUD) operation in WPF Scheduler.
You can refer to our WPF Scheduler feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!