Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
580
How to prohibit month changing when the mouse's left button is down and move mouse outside the calendar in singleselect mode
posted

How to prohibit month changing when the LeftButton of mouse is down and then move mouse outside the calendar panel with single selectmode in XamMonthCalendar

 

There isn't  such a problem with range select mode.

  • 35319
    Verified Answer
    posted

    Hello,

     

    I have been looking into your question and I can suggest you handle the ‘ExecutingCommand’ event and implement the following functionality  in its body :

     

       private void xamMonthCalendar1_ExecutingCommand(object sender,Infragistics.Windows.Controls.Events.ExecutingCommandEventArgs e)

            {

                if (Mouse.LeftButton == MouseButtonState.Pressed && xamMonthCalendar1.SelectedDate.HasValue == true && Mouse.Captured == xamMonthCalendar1)

                {

                  e.Cancel = true;

                }

                if (Mouse.LeftButton == MouseButtonState.Released )

                {

                    e.Cancel = false;

                }

            }

     

     

    This way when you select a day and move the mouse out of the calendar panel, the month will not be changed.

     

    If you need any further assistance on this matter, feel free to ask.