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,
Sorry, I missed that requirement the first time I read your post. I assume you want to prevent mouse wheel processing; you can do that by handling the MouseWheel event, upcasting the event args to type HandledMouseEventArgs, and setting the Handled property to true.
Can you post an example of how to call the protected override void OnMouseWheel( MouseEventArgs e) and tie it to the ultraMonthViewMulti control?
Cheers,Amy
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();
}
Thanks for the feedback.
Thanks Georgi, that's exactly what I was looking for!
Cheers,
Amy
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
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!