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

RadScheduleView appointment changes commit.

6 Answers 289 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Nadisan
Top achievements
Rank 2
Nadisan asked on 19 Dec 2011, 03:39 PM
Hello,

I'm trying to replace the window that appears on AppointmentEditing event of the radscheduleview.


I'm updating an appointment, then I try to commit the changes with .Commit() method (which actually returns false -> there must be an error in this method, but I can't see it :P )

I'll give you a code snippet of what i'm trying to do:

  private void AppointmentEditingHandler(object sender, AppointmentEditingEventArgs e)
        {
            try
            {
...
 var appointment = e.Appointment;
...
 var radScheduleView = (RadScheduleView)e.Source;
                appointment.BeginEdit();
                appointment.Start = newStartDateTime;
                appointment.End = newStopDateTime;
                appointment.Subject = courseTypeToString;
                appointment.EndEdit();
                radScheduleView.Commit();
 
                e.Handled = true;
                e.Cancel = true;
                e.RoutedEvent = null;
}
catch (exception ex)
{}

I've tried every single thing on your forum but I haven't manage to make it work.

Please help me with the above issue, it's VERY annoying.

6 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 20 Dec 2011, 12:55 PM
Hi Nadisan,

Could you try with this:
radScheduleView.BeginEdit(appointment);
appointment.Start = newStartDateTime;
appointment.End = newStopDateTime;
appointment.Subject = courseTypeToString;
radScheduleView.Commit();

You should not call BeginEdit/EndEdit on the appointment. They are called internally when you call BeginEdit/Commit/Cancel on RadScheduleView.

Kind regards,
Valeri Hristov
the Telerik team

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

0
Nadisan
Top achievements
Rank 2
answered on 20 Dec 2011, 12:58 PM
Hello Valeri Hristov,

If i call radScheduleView.BeginEdit(appointment); then the main method AppointmentEditingHandler is called again, I think I forgot to specify the contains of the Scheduleview.xaml.

So, the xaml looks like:

<Controls:RadScheduleView x:Name="Scheduler" IsInlineEditingEnabled="False" AppointmentsSource="{Binding Appointments}" AppointmentEditing="AppointmentEditingHandler">
            <Controls:RadScheduleView.ViewDefinitions>
                <Controls:DayViewDefinition/>
                <Controls:WeekViewDefinition/>
                <Controls:MonthViewDefinition/>
            </Controls:RadScheduleView.ViewDefinitions>
        </Controls:RadScheduleView>
0
Valeri Hristov
Telerik team
answered on 20 Dec 2011, 01:12 PM
Hello Nadisan,

You should not call BeginEdit/Commit in the editing events of RadScheduleView. The control supports only one appointment in edit mode, hence when you call BeginEdit again the previously edited appointment changes are cancelled.
 
The recommended way to customize the RadScheduleView dialogs is described here (you still can edit only one appointment at a time):
http://www.telerik.com/help/silverlight/radscheduleview-features-custom-dialogs.html

Best wishes,
Valeri Hristov
the Telerik team

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

0
Nadisan
Top achievements
Rank 2
answered on 20 Dec 2011, 01:21 PM
Hello Valeri Hristov,

I don't want to edit more than one appointment.

What I've noticed is that if I leave the RoutedEvent not null
// e.RoutedEvent = null;
Then the default appointment editor is shown. If I press the "Ok" button, then the scheduleView will update with the values I've set in code behind (same thing happens if I surf throw ViewDefinintions:    DayViewDefinition -> WeekDefinition -> DayViewDefinition => view updated with the values I've assigned in code behind).

There must be a way for me to update the schedule view UI.

Thanks for your support!!!
0
Nadisan
Top achievements
Rank 2
answered on 20 Dec 2011, 04:04 PM
I still need support for this thread, please.
0
Nadisan
Top achievements
Rank 2
answered on 29 Dec 2011, 02:24 PM
I've found an ugly work-around for this issue:

var selectedIndex = radScheduleView.ActiveViewDefinitionIndex;
                radScheduleView.ActiveViewDefinitionIndex = selectedIndex < 1 ? selectedIndex + 1 : selectedIndex - 1;
                radScheduleView.ActiveViewDefinitionIndex = selectedIndex;
Tags
ScheduleView
Asked by
Nadisan
Top achievements
Rank 2
Answers by
Valeri Hristov
Telerik team
Nadisan
Top achievements
Rank 2
Share this question
or