How to cancel Double-Click on an appointment (without cancelling the right click context menu)

6 posts, 0 answers
  1. Craig
    Craig avatar
    14 posts
    Member since:
    Oct 2013

    Posted 15 Jun 2016 Link to this post

    I need the right-click context, so setting the scheduler to readonly isn't an option.

    I need to stop the scheduler showing the edit dialog when an appointment is double clicked... Any ideas?

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3477 posts

    Posted 15 Jun 2016 Link to this post

    Hello Craig,

    Thank you for writing. 

    In order to prevent showing the edit dialog when double clicking an appointment element you can use the following code snippet:
    public class CustomScheduler : RadScheduler
    {
        public override string ThemeClassName
        {
            get
            {
                return typeof(RadScheduler).FullName;
            }
        }
     
        protected override void OnAppointmentElementDoubleClick(object sender, EventArgs args)
        {
        }
    }

    I hope this information helps. Should you have further questions I would be glad to help.

    Regards,
    Dess
    Telerik
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
  3. Craig
    Craig avatar
    14 posts
    Member since:
    Oct 2013

    Posted 22 Jun 2016 Link to this post

    Dess, Thanks for your suggestion.  This was required on an existing code base, so couldn't make use of inheriting from RadScheduler.... Here is how I managed to achieve this without inheriting:

     

    private bool _schedulerDoubleClicked;

    // Event to catch the double click
    private void radScheduler_DoubleClick(object sender, EventArgs e)

    {
        _schedulerDoubleClicked = true;
    }

    // Event to cancel the dialog if the double click was performed
    private void radScheduler_AppointmentEditDialogShowing(object sender, AppointmentEditDialogShowingEventArgs e)
    {
        if (_schedulerDoubleClicked)
        {
            _schedulerDoubleClicked = false;
            e.Cancel = true;
        }

    }

  4. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3477 posts

    Posted 23 Jun 2016 Link to this post

    Hello Craig,

    Thank you for writing back. 

    I am glad that you have found a suitable solution for your case. However, the suggested approach from my previous post can be applied to any existing application as well. It is just necessary to replace the default RadScheduler instance in the designer file with the custom one. However, your code snippet seems OK. Feel free to use this one which suits your requirement best.

    I hope this information helps. If you have any additional questions, please let me know.

    Regards,
    Dess
    Telerik
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
  5. Roshdy
    Roshdy avatar
    1 posts
    Member since:
    Nov 2019

    Posted 27 Nov Link to this post

    Just for Future Reference - the question has been answered perfectly at the time  by Telerik Dev Team it was posted

    But to those who might want to disable double click with a single line 

    RadScheduler has an event called MouseDoubleClick 

    all you need to do is this single line - of course you can encapsulate it according to your requirements

    Code in Vb.net

    Private Sub RadScheduler1_MouseDoubleClick(sender As Object, e As MouseEventArgs) Handles RadScheduler1.MouseDoubleClick
        RadScheduler1.Behavior.SelectedElement.DoubleClickEnabled = False
    End Sub
  6. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3477 posts

    Posted 28 Nov Link to this post

    Hello, Ahmed,

    Thank you for sharing your solution with the community. Indeed, the provided code snippet is an elegant alternative approach for disabling the double click handling for the AppointmentElement

    As a reward, I have also updated your Telerik points.

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top