I have control derived from ScheduleView and collection of custom Appointments filled programmatically and assigned to AppointmentSource.
private ObservableCollection<CalendarDataItem> calendardataitems = new ObservableCollection<CalendarDataItem>();
. . .
this.AppointmentsSource = calendardataitems;
Appointments are visible in ScheduleView and show expected data.
When I change appointment’s property in collection then changes are not visible in ScheduleView.
I use my custom form for editing of Appointments. Form is used on other places of application so is not possible to derive it from dialog included in ScheduleView.
I think that I should call a method from ScheduleView to refresh view but I do not know what method.
Can you help me?
12 Answers, 1 is accepted
Please read our article how to edit appointments programmatically here.
If you still need to edit appointment in the calendardataitems collection directly I suggest you after editing to remove the appointment and add it again to the collection.This should reset the view.
Regards,
Rosi
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
I have done some test with removing and adding appointment to collection and also I have tried to set AppointmentsSource to null
and again to calendardataitems. I can see changes but I have problem with SelectedAppointment and when I have slot expanded to see many appointments then it is collapsed after reassign AppointmentsSource.
I still think that there should be method for redraw of content of ScheduleView.
Thank you for answer
I am sorry for the incorrect link,the correct one is posted below:
http://www.telerik.com/help/silverlight/radscheduleview-end-user-capabilities-edit-appointment.html
Also, I suggest you not reset the whole AppointmentsSource, but remove and add only the edited item:
something like:
var itemToEdit =calendaritems.Firts();
calendaritems.Remove(itemToEdit);
calendaritems.Add(itemToEdit);
All the best,
Rosi
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
I'm currently study Telerik controls with idea to buy them.
And I actually disappointed with your answer.
What about normal MVVM approach?
Why Schedule view do not track changes in AppointmentsSource (this is possible since source is ObservableCollection and Appointments impement INotifyPropertyChanged)?
It is normally to change things in ViewModel and expect UI to be automatically refresh without additional Voodoo magic.
In my particular case, I have undesired side effects when Add/Remove Appointments
(additional calls to server in other logic of view model).
Is Add/Remove really only option for refresh ScheduleView from ViewModel?
Regards,
Andris
Due to some internal logic into the Appointment class the best way to achieve this is to use the RadScheduleView's BeginEdit and Commit methods. I believe this will not cause any additional calls to the server.
Another tricky way to update the RadScheduleView from the ViewModel would be to bind TwoWay its ActiveViewDefinitionIndex property. When this property changes the RadScheduleView will be updated.
Greetings,
Ivo
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
My situation is slightly similar.
But I need to refresh my entire appointments source.
In essense, the user will have multiple 'calendars'.
So when they select Calendar 1, they can view/edit/filter all the appointments (and appointment types) for Calendar 1.
And then when they select Calendar 2, the ObservableCollection of appointments will change entirely.
But the ScheduleView is not being updated/refreshed.
And i have tried all the methods mentioned above.
I'm using purely MVVM.
How would I update the view?
Regards and Thanks,
Justin
I noticed you have opened a support ticket regarding the same questions. I have already replied you there - can you please check my answer and let me know if it helps. I'll also copy my reply here:
If you reset the property bound to AppointmentsSource of the control (set new collection to the property) you would need to raise property changed in order to notify the UI that the property is changed. If you just clear the collection everything should work as expected.
Hope this helps.
Regards,
Kalin
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
Hello,
When rebinding the AppointementsSource the scroll bar is reset to the top, I did try to find a way to avoid that behavior but with no success any clue about that ?
By design the scroll is being reset if the AppointmentsSource is set to null even the RetainScrollPosition is set to True - so I assume you set it null first and then to the new collection. What I can suggest you would be to try not setting it null and see if this helps (the RetainScrollPosition property should be True). However if this doesn't help - I would like to ask you to share some sample code reproducing the observed behavior, so we can check it on our side.
Hope this will work for you.
Regards,
Kalin
Telerik
Hello,
My UI not updating but it shoes the records in ViewModel.
I'm using
protected override DateTime GetVisibleRangeStart(DateTime currentDate, System.Globalization.CultureInfo culture, DayOfWeek? firstDayOfWeek) to get the current date and fetching the events(Appointments) from my DB, but i can't able to refresh or stick it to the SchedulerView.
I have raised the property changed in order to notify the UI but no any effect.
Please help me out to get it solved.