RadScheduleView appointment changes commit.

7 posts, 0 answers
  1. Nadisan
    Nadisan avatar
    8 posts
    Member since:
    Jun 2012

    Posted 19 Dec 2011 Link to this post

    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.
  2. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 20 Dec 2011 Link to this post

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

  3. UI for WPF is Visual Studio 2017 Ready
  4. Nadisan
    Nadisan avatar
    8 posts
    Member since:
    Jun 2012

    Posted 20 Dec 2011 Link to this post

    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>
  5. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 20 Dec 2011 Link to this post

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

  6. Nadisan
    Nadisan avatar
    8 posts
    Member since:
    Jun 2012

    Posted 20 Dec 2011 Link to this post

    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!!!
  7. Nadisan
    Nadisan avatar
    8 posts
    Member since:
    Jun 2012

    Posted 20 Dec 2011 Link to this post

    I still need support for this thread, please.
  8. Nadisan
    Nadisan avatar
    8 posts
    Member since:
    Jun 2012

    Posted 29 Dec 2011 Link to this post

    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;
Back to Top
UI for WPF is Visual Studio 2017 Ready