Disable edit dialogue based on appointment category

13 posts, 1 answers
  1. Sergey
    Sergey avatar
    26 posts
    Member since:
    Jun 2012

    Posted 27 Jun 2012 Link to this post

    Is it possible to prevent edit appointment dialogue from opening when the user double clicks on appointment of specific category?
  2. Sergey
    Sergey avatar
    26 posts
    Member since:
    Jun 2012

    Posted 27 Jun 2012 Link to this post

    I'm using AppointmentEditingEvent and set e.Cancel = true, but the dialogue still pops up.
  3. DevCraft banner
  4. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 28 Jun 2012 Link to this post

    Hello Sergey,

    To disable dialogs from showing you need to handle the ShowDialog event in RadScheduleView.

    More information on this topic in this article.

    Greetings,
    Vladi
    the Telerik team

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

  5. Sergey
    Sergey avatar
    26 posts
    Member since:
    Jun 2012

    Posted 29 Jun 2012 Link to this post

    This article describes how to disable all edit dialogs. Is it possible to disable edit dialogs only for jobs of specific category?
  6. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 29 Jun 2012 Link to this post

    Hello Sergey,

    In the ShowDialog event of the RadScheduleView the passed ShowDialogEventArgs e contains all of the appointment class information, you can use that argument to filter the wanted appointment category and set a true value to the Cancel property of that appointment.

    Regards,
    Vladi
    the Telerik team

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

  7. Sergey
    Sergey avatar
    26 posts
    Member since:
    Jun 2012

    Posted 29 Jun 2012 Link to this post

    I can't find any of the appointment class information in ShowDialogEventArgs e. Can you tell me which property I should be looking at?
  8. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 02 Jul 2012 Link to this post

    Hello Sergey,

    In the ShowDialog event the passed ShowDialogEventArgs argument contains the property DialogViewModel that could be cast to AppointmentDialogViewModel. That viewModel contains all of the appointment class information which can be used to filter the appointment's category.
     
    More detailed information on events in RadScheduleView in this article.

    Regards,
    Vladi
    the Telerik team

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

  9. Sergey
    Sergey avatar
    26 posts
    Member since:
    Jun 2012

    Posted 03 Jul 2012 Link to this post

    Thanks!
  10. Sergey
    Sergey avatar
    26 posts
    Member since:
    Jun 2012

    Posted 03 Jul 2012 Link to this post

    Sorry, I still cannot find the appointment category.

    AppointmentDialogViewModel has only property Categories, which contains a list of two categories, none of which is correct one. 

    It does work, for example, in the AppointmentEditing event, where AppointmentEditingEventArgs argument contains the property Appointment, which has the property Category which always contains correct appointment category no matter which appointment I double click.
  11. Sergey
    Sergey avatar
    26 posts
    Member since:
    Jun 2012

    Posted 06 Jul 2012 Link to this post

    Anyone have any ideas? Should I submit a ticket?
  12. Answer
    Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 09 Jul 2012 Link to this post

    Hi Sergey,

    Here is sample code representing the ShowDialog event handler that cancels the ShowDialog for appointments with Blue Category:

    private void RadScheduleView_ShowDialog(object sender, Telerik.Windows.Controls.ShowDialogEventArgs e)
    {
        var viewModel = e.DialogViewModel as AppointmentDialogViewModel;
        var currentAppointment = viewModel.Occurrence.Appointment as Task;
     
        if ((currentAppointment.Category != null) && (currentAppointment.Category.CategoryName == "Blue Category"))
        {
            e.Cancel = true;
        }
    }

    Hope this helps.

    Kind regards,
    Vladi
    the Telerik team

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

  13. Sergey
    Sergey avatar
    26 posts
    Member since:
    Jun 2012

    Posted 09 Jul 2012 Link to this post

    Aha, so it was Occurrence property! Thanks!
  14. Sandi Markon
    Sandi Markon avatar
    101 posts
    Member since:
    Jul 2012

    Posted 16 Jul 2012 Link to this post

    You could also add "e.Handled = true" to your original attempt, Sergey, and it also shouldn't open up the dialog (it works in my case).
Back to Top
DevCraft banner