scheduler refresh after editing appointment
Hi,
In my project, I use sfscheduler control with custom scheduler Editor.
After editing it (end time for example), I save modifications in the appointment, but the appointment not resizing.
However, if I edit the appointment, the end time has been modified.
How can I refresh the scheduler?
Thanks
Jim
Hi Jim,
# Regarding “scheduler refresh after editing appointment”:
We have published a detailed knowledge base (KB) article titled on "How to add a custom appointment editor in WPF Scheduler," which you can access using the following link:
You can access the KB article through the following link:
https://support.syncfusion.com/kb/article/10896/how-to-add-custom-appointment-editor-in-wpf-scheduler-calendar
We have checked the reported query with the KB article and
attempted to replicate the scenario on our end. However, we were unable to
reproduce the issue. When we modified the EndTime, the appointment resized as
expected.
Could you please confirm with this KB article
and let us know whether you are still experiencing the same issue? If this
article does not address your specific issue, please provide additional details
such as a sample project that reproduces the issue, a video demonstration, or
screenshots to help us better understand the problem. These details will assist
us in evaluating your query and providing an appropriate solution.
Regards,
Tamilarasan G.
Hi,
Thank you for your answer.
When I add my appointment to the appointment collection, it appears on the scheduler, but I don't know how to update an existing appointment?
Thanks
Jim
Hi Jim,
To update an existing appointment when opening the editor, you can access the appointment using the AppointmentEditorOpening event. After making the necessary changes, the updated values can be saved back to the existing appointment when the save button is clicked. Below is an example of how to implement this:
public partial class AppointmentEditor : Window
{
private SfScheduler scheduler;
private ScheduleAppointment appointment;
public AppointmentEditor(SfScheduler scheduler, ScheduleAppointment appointment, DateTime dateTime)
{
this.scheduler = scheduler;
this.appointment = appointment;
}
private void OnSaveClicked(object sender, RoutedEventArgs e)
{
if (appointment == null)
{
var scheduleAppointment = new ScheduleAppointment();
scheduleAppointment.Subject = this.Subject.Text;
scheduleAppointment.StartTime = this.StartDatePicker.Value.Value.Date.Add(this.StartTimePicker.Value.Value.TimeOfDay);
scheduleAppointment.EndTime = this.EndDatePicker.Value.Value.Date.Add(this.EndTimePicker.Value.Value.TimeOfDay);
scheduleAppointment.Location = this.location.Text;
scheduleAppointment.IsAllDay = (bool)this.allDay.IsChecked;
scheduleAppointment.Notes = this.description.Text;
scheduleAppointment.Reminders = (ObservableCollection<SchedulerReminder>)this.ReminderList.ItemsSource;
if ((bool)this.timeZone.IsChecked)
{
scheduleAppointment.StartTimeZone = this.TimeZoneMenu.Text;
scheduleAppointment.EndTimeZone = this.TimeZoneMenu.Text;
}
if (this.scheduler.ItemsSource == null)
{
this.scheduler.ItemsSource = new ScheduleAppointmentCollection();
}
(this.scheduler.ItemsSource as ScheduleAppointmentCollection).Add(scheduleAppointment);
}
else
{
appointment.Subject = this.Subject.Text;
appointment.StartTime = this.StartDatePicker.Value.Value.Date.Add(this.StartTimePicker.Value.Value.TimeOfDay);
appointment.EndTime = this.EndDatePicker.Value.Value.Date.Add(this.EndTimePicker.Value.Value.TimeOfDay);
appointment.Location = this.location.Text;
appointment.IsAllDay = (bool)this.allDay.IsChecked;
appointment.Notes = this.description.Text;
appointment.Reminders = (ObservableCollection<SchedulerReminder>)this.ReminderList.ItemsSource;
appointment.StartTimeZone = this.TimeZoneMenu.Text;
appointment.EndTimeZone = this.TimeZoneMenu.Text;
}
this.Close();
}
}
For more
detailed information, please refer to the Knowledge Base article, which
includes code snippets and a sample demonstrating this approach. If you
encounter any issues, you can modify the sample provided in the article to
replicate the issue and share it with us, or alternatively, share your sample
where you are facing the issue. This will help us analyze the problem and offer
a more accurate solution.
Regards,
Tamilarasan G.
Hi,
I don't know why it doesn't work.
If I use ScheduleAppointment class, it works very well. I can change StartTime property and the appointment resizing automatically
If I use my custom class , after saving, the appointment not resizing.
Here is my Custom Appointment class:
using Syncfusion.UI.Xaml.Scheduler;
using System.ComponentModel;
using System.Windows.Media;
namespace WpfApp1
{
public class Appointment : ScheduleAppointment, INotifyPropertyChanged
{
private String _name;
public String Name
{
get { return _name; }
set
{
_name = value;
OnPropertyChanged("Name");
}
}
public new event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChanged(string propertyName)
{
var eventHandler = this.PropertyChanged;
if (eventHandler != null)
{
eventHandler(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}
In my main window :
Appointments = new ScheduleAppointmentCollection();
for (int a = 0; a <= 10; a++)
{
var newApp= new Appointment() //If I use ScheduleAppointment, it works fine !
{
Subject = "Subject " + a,
Name = "Name " + a,
StartTime = Convert.ToDateTime(plann.Rows[a]["datedebut"].ToString()),
EndTime = Convert.ToDateTime(plann.Rows[a]["datefin"].ToString()),
ResourceIdCollection = new ObservableCollection<object>() {a}
};
Appointments.Add(newApp);
}
Schedule.ItemsSource = Appointments;
Hi Jim,
Regarding issue Scheduler
appointment fails to resize when using custom appointment inherited from
ScheduleAppointment class
We have checked, and we can replicate the reported issue from our end. We have logged an issue report for the same; we will fix this issue and include the issue fix in our weekly NuGet release update, which is expected to be available by February 11, 2025. We appreciate your patience until then.
You can track the status of this report through the following feedback link: https://www.syncfusion.com/feedback/64858
Note: The provided feedback link is private, and you need to log in to view this feedback.
Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization
Regards,
Tamilarasan G.
Hi Jim,
Regarding issue Appointment fails to resize when using custom appointment inherited from ScheduleAppointment.
We have fixed the reported issue and included the issue fix in our latest weekly NuGet release update version 28.2.5, which is available for download at nuget.org
Root cause: The issue occurred because the custom appointment, inherited from ScheduleAppointment, is being treated as a custom appointment rather than as a ScheduleAppointment.
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you require any further assistance.
Regards,
Tamilarasan G.
Hi,
Thank you for this release. Effectively, this release fixed the bug, and now, I can change the custom property "name" from my customAppointment and it appears in the scheduler.
But, If I change starTime or endTime (inherits from SchedulerAppointment), for example, the time is saved in the collection, but the meting is not resized
private void Schedule_AppointmentTapped(object sender, AppointmentTappedArgs e)
{
CustomAppointment ca = (CustomAppointment)e.Appointment;
ca.EndTime = ca.EndTime.AddMinutes(-15); //saved, but no changes on Scheduler
}
Hi Jim,
Regarding issue Appointment fails to resize when using custom
appointment inherited from ScheduleAppointment.
Based on our review, we noticed that you have created a new PropertyChanged
event of type PropertyChangedEventHandler in the custom appointment
class, which prevents the Scheduler's base PropertyChanged event from being
triggered.
To resolve
this, we recommend using the Scheduler's RaisePropertyChanged method
directly and passing the property name as a parameter, as demonstrated below.
|
private String _name; public String Name { get { return _name; } set { _name = value; base.RaisePropertyChanged(nameof(Name)); } } |
We
have prepared a simple sample demonstrating this. Please check the attached
sample for your reference.
If you have any further questions or require assistance with any other
aspect, please don't hesitate to let us know. We are here to help.
Regards,
Tamilarasan G.
Attachment: WPFSchedulerSample1_8716a501.zip
Tank you very much
Hi Jim,
We are glad that your issue has been resolved! Please let us know if you need further assistance. As always, we are happy to help you out.
Regards,
Vidyalakshmi M.
- 10 Replies
- 3 Participants
- Marked answer
-
TC the carpenter
- Dec 20, 2024 12:41 PM UTC
- Mar 17, 2025 05:04 AM UTC