Changing appointment start/end not reflected on UI?

6 posts, 0 answers
  1. Philipp
    Philipp avatar
    17 posts
    Member since:
    Jun 2011

    Posted 12 Dec 2011 Link to this post

    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);
            }
        }
         
        ...
    }
  2. George
    Admin
    George avatar
    1332 posts

    Posted 13 Dec 2011 Link to this post

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

  3. UI for WPF is Visual Studio 2017 Ready
  4. Philipp
    Philipp avatar
    17 posts
    Member since:
    Jun 2011

    Posted 13 Dec 2011 Link to this post

    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
  5. George
    Admin
    George avatar
    1332 posts

    Posted 15 Dec 2011 Link to this post

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

  6. Stuart Cotts
    Stuart Cotts avatar
    16 posts
    Member since:
    Mar 2010

    Posted 20 Jun 2013 Link to this post

    >>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
  7. George
    Admin
    George avatar
    1332 posts

    Posted 25 Jun 2013 Link to this post

    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.

Back to Top
UI for WPF is Visual Studio 2017 Ready