I am looking for a Control which behaves like the Numeric UPAndDown Control. Would be there any way to get the HScrollbar working like it or do you have any other suggestions? thank you
1 Answer, 1 is accepted
0
Angel
Telerik team
answered on 11 Dec 2006, 02:21 PM
Hi Kerstin,
HScrollBar and VScrollBar cannot be used directly as the control you need. However, you can achieve similar behavior with a few lines of code:
1. Hide the scroll thumb.
this.radHScrollBar1 = new Telerik.WinControls.UI.RadHScrollBar(); ... this.radHScrollBar1.ScrollBarElement.Children[4].Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
2. If the user clicks in the area between the two scroll buttons LargeScroll events will be raised (Page Up/Down for vertical scroll or Page Left/Right for horizontal scroll). You can handle the "Scroll" and the "ValueChanged" events to disable this behavior.
private bool largeValueChanging = false; private int oldValue;
private void radHScrollBar1_ValueChanged(object sender, EventArgs e) { if (this.largeValueChanging) { this.largeValueChanging = false; RadScrollBar scrollBar = (RadScrollBar)sender; scrollBar.Value = this.oldValue; } } Let us know if you experience any problems with this approach.