This is a migrated thread and some comments may be shown as answers.

update UI after collection of Appointment change

12 Answers 349 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Lucie
Top achievements
Rank 1
Lucie asked on 18 Jan 2012, 11:01 AM

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

Sort by
0
Rosi
Telerik team
answered on 18 Jan 2012, 05:20 PM
Hi,

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 >>

0
Lucie
Top achievements
Rank 1
answered on 19 Jan 2012, 06:51 AM
I am sorry your link to sample is wrong. Can you correct it?

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
0
Rosi
Telerik team
answered on 19 Jan 2012, 08:55 AM
Hi,

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 >>

0
Andris
Top achievements
Rank 1
answered on 05 Sep 2012, 08:58 AM
Hi Rosi,

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
0
Ivo
Telerik team
answered on 06 Sep 2012, 12:36 PM
Hello 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.

0
Justin
Top achievements
Rank 1
answered on 20 Nov 2014, 12:45 PM
Hi Team,

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 
0
Justin
Top achievements
Rank 1
answered on 20 Nov 2014, 12:47 PM
Oh yes, forgot to add that i'm using Telerik UI for WPF
0
Kalin
Telerik team
answered on 20 Nov 2014, 04:17 PM
Hi 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.

 
0
guillaume rousseau
Top achievements
Rank 1
answered on 09 Feb 2016, 06:49 PM

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 ?

 

0
guillaume rousseau
Top achievements
Rank 1
answered on 09 Feb 2016, 06:57 PM
even with RetainScrollPosition="True" in the xaml, it reset the scroll bar to top
0
Kalin
Telerik team
answered on 12 Feb 2016, 08:32 AM
Hi Guillaume,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Karthik
Top achievements
Rank 1
answered on 07 Jun 2016, 11:30 AM

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.

Tags
ScheduleView
Asked by
Lucie
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Lucie
Top achievements
Rank 1
Andris
Top achievements
Rank 1
Ivo
Telerik team
Justin
Top achievements
Rank 1
Kalin
Telerik team
guillaume rousseau
Top achievements
Rank 1
Karthik
Top achievements
Rank 1
Share this question
or