Hi,
If the focus is on the ultraMonthViewMulti control and if the mouse is scrolled then months of the control scrolled, i want to stop this behaviour. Is there any property to do that?
Regards,
Abid
No, the control does not provide a way to prevent scrolling through the public object model. You can, however, hack this out by handling VisibleMonthsChanged and setting the FirstMonth property asynchronously therein.
Example:void mvm_VisibleMonthsChanged(object sender, EventArgs e){ this.BeginInvoke( new MethodInvoker(this.OnVisibleMonthsChangedAsync) );}
private void OnVisibleMonthsChangedAsync(){ this.mvm.FirstMonth = this.mvm.CalendarInfo.GetMonth( DateTime.Today );}
Hi Brian,
Thanks for your reply,
This has actually stopped the month scrolling by mouse but it has also stopped changing the months via buttons. My requirement is to stop that scrolling through mouse but if user clicks on the buttons at the control the months should get changed.
Any suggestions to extract such behaviour.
Thanks and Regards,
Ok, was much more simple then I first thought. Here's how you do it:
to assign the MouseWheel to the UltraMonthViewMulti:
this.myUltraMonthViewMulti.MouseWheel += new MouseEventHandler(myUltraMonthViewMulti_MouseWheel);
then add
private void myUltraMonthViewMulti_MouseWheel(object sender, MouseEventArgs e)
{
//whatever you want here...I changed the focus to another control:
this.ultraDayView1.Focus();
}
So...I've gotten this far...can you tell me how to cancel the scroll? I did sort of hack code by taking the focus off the control, but it still scrolls a minimum of 1 month before losing focus! Can you tell me how to cancel the scroll from this point...before it scrolls?
//THIS IS WHERE I NEED TO KNOW HOW TO CANCEL THE SCROLLING...AS THE LOSING FOCUS SCROLLS BEFORE IT LOSES FOCUS!
There are many different approaches to solve this task. One possible solution could be:
public partial class Form1 : Form
public Form1()
InitializeComponent();
ultraMonthViewMulti1.MouseWheel += new MouseEventHandler(ultraMonthViewMulti1_MouseWheel);
private bool IsMouseWheel;
void ultraMonthViewMulti1_MouseWheel(object sender, MouseEventArgs e)
IsMouseWheel = true;
private void ultraMonthViewMulti1_BeforeMonthScroll(object sender, Infragistics.Win.UltraWinSchedule.BeforeMonthScrollEventArgs e)
if (IsMouseWheel)
e.Cancel = true;
IsMouseWheel = false;
Please take a look on attached sample for more details and if you have any questions, feel free to write me
Thanks Georgi, that's exactly what I was looking for!
Cheers,
Amy
Thanks for the feedback.