diff --git a/components/RangeSelector/src/RangeSelector.Input.Drag.cs b/components/RangeSelector/src/RangeSelector.Input.Drag.cs
index 5e5e051c..80904df9 100644
--- a/components/RangeSelector/src/RangeSelector.Input.Drag.cs
+++ b/components/RangeSelector/src/RangeSelector.Input.Drag.cs
@@ -136,7 +136,7 @@ private void Thumb_DragStarted(Thumb thumb)
if (_toolTip != null)
{
- if (Orientation == Orientation.Vertical && VerticalToolTipPlacement == VerticalToolTipPlacement.None)
+ if (!IsThumbToolTipEnabled || (Orientation == Orientation.Vertical && VerticalToolTipPlacement == VerticalToolTipPlacement.None))
{
_toolTip.Visibility = Visibility.Collapsed;
}
diff --git a/components/RangeSelector/src/RangeSelector.Input.Key.cs b/components/RangeSelector/src/RangeSelector.Input.Key.cs
index 9e29c4ed..390f5f53 100644
--- a/components/RangeSelector/src/RangeSelector.Input.Key.cs
+++ b/components/RangeSelector/src/RangeSelector.Input.Key.cs
@@ -77,6 +77,7 @@ private void MaxThumb_KeyDown(object sender, KeyRoutedEventArgs e)
private void ShowToolTip()
{
+ if (!IsThumbToolTipEnabled) return;
var isHorizontal = Orientation == Orientation.Horizontal;
if (!isHorizontal && VerticalToolTipPlacement == VerticalToolTipPlacement.None) return;
if (_toolTip != null)
diff --git a/components/RangeSelector/src/RangeSelector.Properties.cs b/components/RangeSelector/src/RangeSelector.Properties.cs
index 264a1ec0..7fdefb24 100644
--- a/components/RangeSelector/src/RangeSelector.Properties.cs
+++ b/components/RangeSelector/src/RangeSelector.Properties.cs
@@ -79,6 +79,26 @@ public partial class RangeSelector : Control
typeof(RangeSelector),
new PropertyMetadata(VerticalToolTipPlacement.Right));
+ ///
+ /// Identifies the property.
+ ///
+ public static readonly DependencyProperty IsThumbToolTipEnabledProperty =
+ DependencyProperty.Register(
+ nameof(IsThumbToolTipEnabled),
+ typeof(bool),
+ typeof(RangeSelector),
+ new PropertyMetadata(true));
+
+ ///
+ /// Identifies the property.
+ ///
+ public static readonly DependencyProperty ThumbToolTipValueConverterProperty =
+ DependencyProperty.Register(
+ nameof(ThumbToolTipValueConverter),
+ typeof(IValueConverter),
+ typeof(RangeSelector),
+ new PropertyMetadata(null));
+
///
/// Gets or sets the absolute minimum value of the range.
///
@@ -164,6 +184,32 @@ public VerticalToolTipPlacement VerticalToolTipPlacement
set => SetValue(VerticalToolTipPlacementProperty, value);
}
+ ///
+ /// Gets or sets a value that indicates whether a tooltip that displays the current value
+ /// is shown for the min and max thumbs.
+ ///
+ ///
+ /// true if a tooltip is shown for the min and max thumbs; otherwise, false. The default is true.
+ ///
+ public bool IsThumbToolTipEnabled
+ {
+ get => (bool)GetValue(IsThumbToolTipEnabledProperty);
+ set => SetValue(IsThumbToolTipEnabledProperty, value);
+ }
+
+ ///
+ /// Gets or sets a custom to be used for the tooltip text conversion
+ /// when is set to true.
+ ///
+ ///
+ /// The converter used to convert the thumb value to a display string. The default is null.
+ ///
+ public IValueConverter ThumbToolTipValueConverter
+ {
+ get => (IValueConverter)GetValue(ThumbToolTipValueConverterProperty);
+ set => SetValue(ThumbToolTipValueConverterProperty, value);
+ }
+
private static void OrientationChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var rangeSelector = d as RangeSelector;
diff --git a/components/RangeSelector/src/RangeSelector.cs b/components/RangeSelector/src/RangeSelector.cs
index c539d6a2..2ddba6b8 100644
--- a/components/RangeSelector/src/RangeSelector.cs
+++ b/components/RangeSelector/src/RangeSelector.cs
@@ -165,7 +165,9 @@ private static void UpdateToolTipText(RangeSelector rangeSelector, TextBlock too
{
if (toolTip != null)
{
- toolTip.Text = string.Format("{0:0.##}", newValue);
+ var converter = rangeSelector.ThumbToolTipValueConverter;
+ var convertedText = converter?.Convert(newValue, typeof(string), null, string.Empty) as string;
+ toolTip.Text = convertedText ?? string.Format("{0:0.##}", newValue);
}
}