Hi to all. I am trying to change the way that the UltraDayView behaves when the user scrolls the mousewheel while the Shift button is depressed. Currently the UltraDayView will scroll up and down regardless of any concurrent keyboard actions, however I wish to have it so that the range of TimeSlots changes so that a ZoomIn/ZoomOut effect is achieved if the mousewheel is scrolled while the Shift button is held down.
So my question is: Is there any easy way to do this? Or do I need to intercept an event somewhere to cancel the scroll action and force the UltraDayView control to changes its VisibleDaysCollection by manual means?
Cheers.
Terribly sorry, I posted an incomplete code sample. Here is the rest:
using Infragistics.Win.UltraWinSchedule;
private List<TimeSlotInterval> allTimeSlotIntervals = new List<TimeSlotInterval>();
this.allTimeSlotIntervals.Clear();Array values = Enum.GetValues( typeof(TimeSlotInterval) );foreach( object value in values ){ this.allTimeSlotIntervals.Add( (TimeSlotInterval)value );}
Thanks Brian. Where did this.allTimeSlotIntervals get its information from?
Interesting idea; here's one possible implementation:
private void dayView_MouseWheel(object sender, MouseEventArgs e){ UltraDayView dayView = sender as UltraDayView;
if ( (Control.ModifierKeys & Keys.Shift) == Keys.Shift ) { int sign = e.Delta > 0 ? 1 : -1; int magnitude = Math.Abs(e.Delta / SystemInformation.MouseWheelScrollDelta); TimeSlotInterval currentValue = dayView.TimeSlotInterval; int index = this.allTimeSlotIntervals.IndexOf(currentValue); int newIndex = index + (sign * magnitude); newIndex = Math.Min( this.allTimeSlotIntervals.Count - 1, newIndex ); newIndex = Math.Max( 0, newIndex );
dayView.TimeSlotInterval = this.allTimeSlotIntervals[newIndex];
HandledMouseEventArgs upcastedArgs = e as HandledMouseEventArgs; if ( upcastedArgs != null ) upcastedArgs.Handled = true; }}