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

Changing appointment start/end not reflected on UI?

5 Answers 167 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Philipp
Top achievements
Rank 1
Philipp asked on 13 Dec 2011, 03:44 AM
Hi all

I have a custom appointment, of which I am modifying both Start and End programmatically if a command is fired. The problem is that setting those properties doesn't result in the UI being updated: The appointment still shows the old start / end boundaries until I change the view. For now, I employed a dirty hack by removing and reinserting the modified item, but this is obviously a horrible workaround.

Thanks for your advice
Philipp

Here's my code:


public class CalendarItemViewModel : AppointmentBase
{
    public LaborTrackingSession Model { get; private set; }
 
    public override DateTime Start
    {
        get { return Model.StartTime.DateTime; }
        set
        {
            Model.StartTime = value;
            OnPropertyChanged(() => Start);
        }
    }
 
    public override DateTime End
    {
        get { return Model.EndTime.HasValue ? Model.EndTime.Value.DateTime : SystemTime.Now().DateTime; }
        set
        {
            Model.EndTime = value;
            OnPropertyChanged(() => End);
        }
    }
     
    ...
}

5 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 13 Dec 2011, 08:54 AM
Hi Philipp,

 
Thank you for contacting us. 

I would suggest editing the appointment using the RadScheduleView.BeginEdit() method. Please, refer to our online documentation for further information - http://www.telerik.com/help/wpf/radscheduleview-end-user-capabilities-edit-appointment.html

Hope this helps. Please do not hesitate to contact us if you have any additional questions.

All the best,
George
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Philipp
Top achievements
Rank 1
answered on 13 Dec 2011, 11:27 PM
George,

I have a clean MVVM layering, so my view model doesn't have a reference to the ScheduleView control - this is an anti-pattern. Any other workarounds?

Thanks,
Philipp
0
George
Telerik team
answered on 15 Dec 2011, 03:22 PM
Hi Philipp,

What I could suggest is removing the edited appointment and adding it again in the appointments source collection. This should do the trick. 

Please, let me know if this helps. I am glad to assist you further.

Greetings,
George
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Stuart Cotts
Top achievements
Rank 1
answered on 20 Jun 2013, 06:57 PM
>>What I could suggest is removing the edited appointment and adding it again in the appointments source collection. This should do the trick. 

>>Please, let me know if this helps. I am glad to assist you further.
>>Greetings,
>>George

I am in the exact same situation using a MVVM pattern with 2013.2.611.40, is there another way to get the UI to update, OnPropertyChanged of Start or End is not doing it and it seems to be overhead to remove, then add the appointment??

Thanks,
Stuart Cotts
0
George
Telerik team
answered on 25 Jun 2013, 03:23 PM
Hi Stuart,

Could you give us more information about the given scenario? Do you use a custom appointment? Please, refer to the following online example where you can find similar scenario - http://demos.telerik.com/silverlight/#ScheduleView/CustomAppointmentAndValidation. You can find the same example for WPF as well. Please, note that changing Start/End properties affects the UI after committing the appointment editing.

Regards,
George
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
ScheduleView
Asked by
Philipp
Top achievements
Rank 1
Answers by
George
Telerik team
Philipp
Top achievements
Rank 1
Stuart Cotts
Top achievements
Rank 1
Share this question
or