Skip to content

Commit 52755d7

Browse files
dotMortenArlodotexe
authored andcommitted
Update _toolTip even if toolTipText isn't available
This allows adding custom content to the tooltip
1 parent 1418ca9 commit 52755d7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

components/RangeSelector/src/RangeSelector.Input.Drag.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ private double DragThumb(Thumb? thumb, double min, double max, double nextPos)
7777

7878
Canvas.SetLeft(thumb, nextPos);
7979

80-
if (_toolTipText != null && _toolTip != null && thumb != null)
80+
if (_toolTip != null && thumb != null)
8181
{
8282
var thumbCenter = nextPos + (thumb.Width / 2);
8383
_toolTip.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
@@ -99,15 +99,16 @@ private void Thumb_DragStarted(Thumb thumb)
9999
Canvas.SetZIndex(otherThumb, 0);
100100
_oldValue = RangeStart;
101101

102-
if (_toolTipText != null && _toolTip != null)
102+
if (_toolTip != null)
103103
{
104104
_toolTip.Visibility = Visibility.Visible;
105105
var thumbCenter = _absolutePosition + (thumb.Width / 2);
106106
_toolTip.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
107107
var ttWidth = _toolTip.ActualWidth / 2;
108108
Canvas.SetLeft(_toolTip, thumbCenter - ttWidth);
109109

110-
UpdateToolTipText(this, _toolTipText, useMin ? RangeStart : RangeEnd);
110+
if (_toolTipText != null)
111+
UpdateToolTipText(this, _toolTipText, useMin ? RangeStart : RangeEnd);
111112
}
112113

113114
VisualStateManager.GoToState(this, useMin ? MinPressedState : MaxPressedState, true);

0 commit comments

Comments
 (0)