diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-05 16:36:08 +0100 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-05 16:36:08 +0100 |
| commit | e86428443b1db0f1d07b51d0c202a111427837d2 (patch) | |
| tree | 092c075041382571a273f91760b7bf137fa2eccb /src/GraphicObjects | |
| parent | aabc901083b8c521f34df863c09340570062b1e6 (diff) | |
ScrollBar derived from NumericControl
Diffstat (limited to 'src/GraphicObjects')
| -rw-r--r-- | src/GraphicObjects/ScrollBar.cs | 53 |
1 files changed, 10 insertions, 43 deletions
diff --git a/src/GraphicObjects/ScrollBar.cs b/src/GraphicObjects/ScrollBar.cs index 3e095457..dddd441e 100644 --- a/src/GraphicObjects/ScrollBar.cs +++ b/src/GraphicObjects/ScrollBar.cs @@ -17,50 +17,18 @@ using System.ComponentModel; namespace Crow { [DefaultTemplate("#Crow.Templates.ScrollBar.goml")] - public class ScrollBar : TemplatedControl + public class ScrollBar : NumericControl { Orientation _orientation; - Slider _slider; - double _maximumScroll; - double _scroll; - public ScrollBar() : base() - { - } - - protected override void loadTemplate(GraphicObject template = null) - { - base.loadTemplate (template); - _slider = this.child.FindByName ("Slider") as Slider; - } + #region CTOR + public ScrollBar() : base() {} + #endregion [XmlAttributeAttribute()][DefaultValue(0.0)] - public virtual double MaximumScroll - { - get { return _maximumScroll; } - set { - if (_maximumScroll == value) - return; - _maximumScroll = value; - registerForGraphicUpdate (); - NotifyValueChanged ("MaximumScroll", _maximumScroll); - } - } - [XmlAttributeAttribute()][DefaultValue(0.0)] - public virtual double Scroll - { - get { return _scroll; } - set { - if (_scroll == value) - return; - _scroll = value; - if (_scroll < 0.0) - _scroll = 0.0; - else if (_scroll > _maximumScroll) - _scroll = _maximumScroll; - registerForGraphicUpdate (); - NotifyValueChanged ("Scroll", _scroll); - } + public override double Maximum { + get { return base.Maximum; } + set { base.Maximum = value; } } [XmlAttributeAttribute()][DefaultValue(Orientation.Vertical)] public virtual Orientation Orientation @@ -76,17 +44,16 @@ namespace Crow } public void onScrollBack (object sender, MouseButtonEventArgs e) { - Scroll -= 50; + Value -= SmallIncrement; } public void onScrollForth (object sender, MouseButtonEventArgs e) { - Scroll += 50; - + Value += SmallIncrement; } public void onSliderValueChange(object sender, ValueChangeEventArgs e){ if (e.MemberName == "Value") - Scroll = Convert.ToDouble(e.NewValue); + Value = Convert.ToDouble(e.NewValue); } } } |