protected override void OnMouseWheel(MouseEventArgs e) { RadScrollLayoutPanel scrollLayoutPanel = this.ColumnChooserElement.ScrollViewer.ScrollLayoutPanel; RadScrollBarElement verticalScrollBar = scrollLayoutPanel.VerticalScrollBar; if (verticalScrollBar.Visibility == ElementVisibility.Visible) { int num1 = Math.Max(1, e.Delta / SystemInformation.MouseWheelScrollDelta); int num2 = Math.Sign(e.Delta) * num1 * SystemInformation.MouseWheelScrollLines; int ypos = verticalScrollBar.Value - num2 * verticalScrollBar.SmallChange; if (ypos > verticalScrollBar.Maximum - verticalScrollBar.LargeChange + 1) { ypos = verticalScrollBar.Maximum - verticalScrollBar.LargeChange + 1; } if (ypos < verticalScrollBar.Minimum) { ypos = 0; } else if (ypos > verticalScrollBar.Maximum) { ypos = verticalScrollBar.Maximum; } if (ypos != verticalScrollBar.Value) { scrollLayoutPanel.ScrollTo(0, ypos); HandledMouseEventArgs handledMouseEventArgs = e as HandledMouseEventArgs; if (handledMouseEventArgs != null) { handledMouseEventArgs.Handled = true; } } } base.OnMouseWheel(e); }
protected override void CreateChildElements() { this.scrollPanel = this.CreateScrollLayoutPanel(); //this.scrollPanel.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize; this.scrollPanel.Scroll += delegate(object sender, ScrollPanelEventArgs args) { OnScroll(args); }; this.scrollPanel.ScrollNeedsChanged += delegate(object sender, ScrollNeedsEventArgs args) { OnScrollNeedsChanged(args); }; this.scrollPanel.ScrollParametersChanged += delegate(object sender, RadPanelScrollParametersEventArgs args) { OnScrollParametersChanged(args); }; this.border = new BorderPrimitive(); this.border.Class = "RadScrollViewBorder"; this.fillPrimitive = new FillPrimitive(); this.fillPrimitive.Class = "RadScrollViewFill"; this.fillPrimitive.GradientAngle = 45f; this.Children.Add(this.fillPrimitive); this.Children.Add(this.border); this.Children.Add(this.scrollPanel); this.scrollPanel.AutoSize = this.AutoSize; this.scrollPanel.AutoSizeMode = this.AutoSizeMode; this.scrollPanel.BindProperty(RadElement.AutoSizeProperty, this, RadElement.AutoSizeProperty, PropertyBindingOptions.OneWay); this.scrollPanel.BindProperty(RadElement.AutoSizeModeProperty, this, RadElement.AutoSizeModeProperty, PropertyBindingOptions.OneWay); }
protected override void CreateChildElements() { this.scrollPanel = this.CreateScrollLayoutPanel(); this.scrollPanel.Scroll += (RadScrollPanelHandler)((sender, args) => this.OnScroll(args)); this.scrollPanel.ScrollNeedsChanged += (ScrollNeedsHandler)((sender, args) => this.OnScrollNeedsChanged(args)); this.scrollPanel.ScrollParametersChanged += (RadPanelScrollParametersHandler)((sender, args) => this.OnScrollParametersChanged(args)); this.border = new BorderPrimitive(); this.border.Class = "RadScrollViewBorder"; this.fillPrimitive = new FillPrimitive(); this.fillPrimitive.Class = "RadScrollViewFill"; this.fillPrimitive.GradientAngle = 45f; this.Children.Add((RadElement)this.fillPrimitive); this.Children.Add((RadElement)this.border); this.Children.Add((RadElement)this.scrollPanel); this.scrollPanel.AutoSize = this.AutoSize; this.scrollPanel.AutoSizeMode = this.AutoSizeMode; int num1 = (int)this.scrollPanel.BindProperty(RadElement.AutoSizeProperty, (RadObject)this, RadElement.AutoSizeProperty, PropertyBindingOptions.OneWay); int num2 = (int)this.scrollPanel.BindProperty(RadElement.AutoSizeModeProperty, (RadObject)this, RadElement.AutoSizeModeProperty, PropertyBindingOptions.OneWay); }