Skip to content

Commit

Permalink
Update _toolTip even if toolTipText isn't available
Browse files Browse the repository at this point in the history
This allows adding custom content to the tooltip
  • Loading branch information
dotMorten authored and Arlodotexe committed Sep 5, 2024
1 parent 1418ca9 commit 52755d7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions components/RangeSelector/src/RangeSelector.Input.Drag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -99,15 +99,16 @@ 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);
_toolTip.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
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);
Expand Down

0 comments on commit 52755d7

Please sign in to comment.