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

Refresh appointment duration

1 Answer 53 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Art Kedzierski
Top achievements
Rank 2
Art Kedzierski asked on 04 Sep 2013, 06:51 PM
I've added a Duration property to a custom appointment (based loosely on one of the Telerik demos) but I'd like to have it refresh in the EditAppointment dialog whenever the Start or End time changes. I've added what i thought would be the appropriate override to my custom Appointment:

private string _apptDur;
public string ApptDur
{
    get
    {
        TimeSpan t = TimeSpan.FromMinutes((this.End - this.Start).TotalMinutes);
        this._apptDur = "";
        if (t.Days > 1)
            this._apptDur += t.Days.ToString() + " days ";
        else if (t.Days == 1)
            this._apptDur += "1 day ";
        if (t.Hours > 1)
            this._apptDur += t.Hours.ToString() + " hours ";
        else if (t.Hours == 1)
            this._apptDur += "1 hour ";
        if (t.Minutes > 0)
            this._apptDur += t.Minutes.ToString() + " min";
 
        return _apptDur;
    }
}
 
protected override void OnPropertyChanged(string propertyName)
{
    base.OnPropertyChanged(propertyName);
 
    if (propertyName == "Start" || propertyName == "End")
    {
        this.OnPropertyChanged("ApptDur");
    }
}

However, I'm not seeing a change in the dialog when times change. Those DatePicker controls are bound in the template to ActualStart and ActualEnd. Where are those defined and should I be watching those instead of Start and End? 

1 Answer, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 05 Sep 2013, 01:14 PM
Hi Art,

The appointment properties are not updated in EditAppointmentDialog as we intentionally do not listen to their PropertyChanged event - it is implemented by design like this as we do not want to update the properties before the dialog is confirmed.

However, you can work-around the behavior by following the approach demonstrated in the following Code Library:
http://www.telerik.com/community/code-library/silverlight/scheduleview/how-to-create-advanced-custom-editapointmentdialog.aspx

I hope this helps.

Regards,
Yana
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
ScheduleView
Asked by
Art Kedzierski
Top achievements
Rank 2
Answers by
Yana
Telerik team
Share this question
or