/// <inheritdoc/> protected override void OnUnload() { VisualChildren.Remove(_thumb); _thumb = null; base.OnUnload(); }
/// <inheritdoc/> protected override void OnUnload() { // Remove thumb and buttons. VisualChildren.Remove(_thumb); _thumb = null; if (_decrementButton != null) { var click = _decrementButton.Events.Get<EventArgs>(ButtonBase.ClickEventId); click.Event -= OnDecrementButtonClick; VisualChildren.Remove(_decrementButton); _decrementButton = null; } if (_incrementButton != null) { var click = _incrementButton.Events.Get<EventArgs>(ButtonBase.ClickEventId); click.Event += OnIncrementButtonClick; VisualChildren.Remove(_incrementButton); _incrementButton = null; } base.OnUnload(); }
//-------------------------------------------------------------- #region Methods //-------------------------------------------------------------- /// <inheritdoc/> protected override void OnLoad() { base.OnLoad(); // Create thumb. var thumbStyle = ThumbStyle; if (!string.IsNullOrEmpty(thumbStyle)) { _thumb = new Thumb { Name = "SliderThumb", Style = thumbStyle, }; VisualChildren.Add(_thumb); } }
//-------------------------------------------------------------- #region Methods //-------------------------------------------------------------- /// <inheritdoc/> protected override void OnLoad() { base.OnLoad(); // Create decrement button. var decrementButtonStyle = DecrementButtonStyle; if (!string.IsNullOrEmpty(decrementButtonStyle)) { _decrementButton = new Button { Name = "DecrementButton", Style = decrementButtonStyle, Focusable = false, // Unlike normal buttons these arrow button can not be focused! IsRepeatButton = true, }; VisualChildren.Add(_decrementButton); var click = _decrementButton.Events.Get<EventArgs>(ButtonBase.ClickEventId); click.Event += OnDecrementButtonClick; } // Create increment button. var incrementButtonStyle = IncrementButtonStyle; if (!string.IsNullOrEmpty(incrementButtonStyle)) { _incrementButton = new Button { Name = "RightDownButton", Style = incrementButtonStyle, Focusable = false, // Unlike normal buttons these arrow button can not be focused! IsRepeatButton = true, }; VisualChildren.Add(_incrementButton); var click = _incrementButton.Events.Get<EventArgs>(ButtonBase.ClickEventId); click.Event += OnIncrementButtonClick; } // Create thumb. var thumbStyle = ThumbStyle; if (!string.IsNullOrEmpty(thumbStyle)) { _thumb = new Thumb { Name = "ScrollBarThumb", Style = thumbStyle, }; VisualChildren.Add(_thumb); } }