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

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

    Posted 15 Jun 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
    Admin
    Dess avatar
    1609 posts

    Posted 15 Jun 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. UI for WinForms is Visual Studio 2017 Ready
  4. Craig
    Craig avatar
    14 posts
    Member since:
    Oct 2013

    Posted 22 Jun 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;
        }

    }

  5. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 23 Jun 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.
Back to Top