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

PropertyChanged on appointment properties

7 Answers 171 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Ingrid
Top achievements
Rank 1
Ingrid asked on 06 Jul 2011, 03:02 PM
Hello,

I have an ObservableCollection of appointments. When you add or remove an appointment in code behind, the UI is changed, but when I change a property for the appointment nothing happens. I want to change the start / end date for some appointments in code behind, but when I do this, I can't see the changes directly on the screen. Is this normal behaviour or am I doing something wrong?

Best regards,
Jeffrey

7 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 06 Jul 2011, 03:08 PM
I am pasting my response from your support ticket here, in case anyone else has the same problem:

You need to call BeginEdit/Commit/Cancel methods before and after you change the appointment properties:

foreach (var appointment in appointmentsToEdit)
{
    this.scheduleView.BeginEdit(appointment);
    appointment.Start = new DateTime(...);
    ...
    this.scheduleView.Commit();
}

This "limitation" is because we use a IEditableCollectionView/ICollectionView as an internal data source and it requires the methods above to be called in order to refresh its content.

Kind regards,
Valeri Hristov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Jeffrey
Top achievements
Rank 1
answered on 07 Jul 2011, 10:04 AM
Valeri,

Thanks for your reply!
I'm using Caliburn. This approach forces me to place code in my code behind file.
Is there another way to do this in a clean MVVM way?

Best regards,
Jeffrey
0
Valeri Hristov
Telerik team
answered on 07 Jul 2011, 10:25 AM
Hi Jeffrey,

Instead of calling BeginEdit/Commit you could remove/add the appointments from the source collection. The ListCollectionView internally does exactly the same thing when you call Commit, so I suppose there will be no performance hit.

All the best,
Valeri Hristov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Ingrid
Top achievements
Rank 1
answered on 23 Aug 2011, 10:20 AM
Hello,

After your reply I tried what you said and it worked, but now, after implementing the Q2 release I see that this functionality doesn't works anymore.
I don't understand what's happening...
Here is my code:

         IoC.Get<IEventAggregator>().Publish(new Messages.ScheduleMessage(tm, false));
         tm.Start = resizeTaakVM.TaakMiddel.Start;
         tm.End = resizeTaakVM.TaakMiddel.End;
         IoC.Get<IEventAggregator>().Publish(new Messages.ScheduleMessage(tm, true));

ScheduleMessage class:

    public class ScheduleMessage
    {
        public ScheduleMessage(IAppointment appointment, bool commit)
        {
            Appointment = appointment;
            Commit = commit;
        }
 
        public IAppointment Appointment { getset; }
        public bool Commit { getset; }
    }

Please help me on this one, I need to fix this quickly!

Best regards,

Jeffrey
0
Rosi
Telerik team
answered on 26 Aug 2011, 03:09 PM
Hi Ingrid,

We are not able to reproduce the problem locally.You can find a sample project attached that works as expected at our side. Is it possible to isolate the issue in small problem so we can test it locally?

Greetings,
Rosi
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Frank
Top achievements
Rank 1
answered on 12 Dec 2018, 12:02 AM

i am very disappointed that we must use old technical ways for refreshing of the subject in the view.

that is not the sense of mvvm and really bad in a time of multithreading, when you refresh the data

in the background.


0
Martin Ivanov
Telerik team
answered on 14 Dec 2018, 05:03 PM
Hello Frank,

Can you please tell me what exactly you mean by old technical ways of refreshing the subject in the view? And also how would you prefer doing this?

Regards,
Martin Ivanov
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
ScheduleView
Asked by
Ingrid
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Jeffrey
Top achievements
Rank 1
Ingrid
Top achievements
Rank 1
Rosi
Telerik team
Frank
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or