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.
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; } }
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.
Thank you very much.