From 72f0b434f5a6f5fa20357436ad1cd5d4813ddd9d Mon Sep 17 00:00:00 2001 From: Morten Nielsen Date: Wed, 21 Aug 2024 10:21:26 -0700 Subject: [PATCH] Update _toolTip even if toolTipText isn't available This allows adding custom content to the tooltip --- components/RangeSelector/src/RangeSelector.Input.Drag.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/RangeSelector/src/RangeSelector.Input.Drag.cs b/components/RangeSelector/src/RangeSelector.Input.Drag.cs index 6112fabc..e8a8fd6a 100644 --- a/components/RangeSelector/src/RangeSelector.Input.Drag.cs +++ b/components/RangeSelector/src/RangeSelector.Input.Drag.cs @@ -77,7 +77,7 @@ private double DragThumb(Thumb? thumb, double min, double max, double nextPos) Canvas.SetLeft(thumb, nextPos); - if (_toolTipText != null && _toolTip != null && thumb != null) + if (_toolTip != null && thumb != null) { var thumbCenter = nextPos + (thumb.Width / 2); _toolTip.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); @@ -99,7 +99,7 @@ private void Thumb_DragStarted(Thumb thumb) Canvas.SetZIndex(otherThumb, 0); _oldValue = RangeStart; - if (_toolTipText != null && _toolTip != null) + if (_toolTip != null) { _toolTip.Visibility = Visibility.Visible; var thumbCenter = _absolutePosition + (thumb.Width / 2); @@ -107,7 +107,8 @@ private void Thumb_DragStarted(Thumb thumb) var ttWidth = _toolTip.ActualWidth / 2; Canvas.SetLeft(_toolTip, thumbCenter - ttWidth); - UpdateToolTipText(this, _toolTipText, useMin ? RangeStart : RangeEnd); + if (_toolTipText != null) + UpdateToolTipText(this, _toolTipText, useMin ? RangeStart : RangeEnd); } VisualStateManager.GoToState(this, useMin ? MinPressedState : MaxPressedState, true);