locked
How to disable slider's tooltip? RRS feed

  • Question

  • Bump!

    I have a slider control which I'd like to work in a non-linear way. On value changes, I'm calculating the actual value, which is autoupdating another display field showing it. The slider's tooltip is in the way here. How do I disable it? It's nowhere in the slider style.

    Sunday, June 24, 2012 9:10 PM

Answers

  • Nevermind, there's actually a properly called ThumbToolTipValueConverter, to which you can a value converter to. In this case, I don't need to hide the tooltip. I'm now remapping the tooltip scale to the respective values it's supposed to represent.

    public class TooltipConverter : IValueConverter
    {
    	Func<double, double> _ranger;
    
    	public object Convert(object value, Type type, object parameter, string language)
    	{
    		double d = (double)value;
    		return _ranger(d);
    	}
    
    	public object ConvertBack(object value, Type type, object parameter, string language)
    	{
    		throw new NotSupportedException();
    	}
    
    	public TooltipConverter(Func<double, double> ranger)
    	{
    		_ranger = ranger;
    	}
    }
    
    
    // Magic
    someSlider.ThumbToolTipValueConverter = new TooltipConverter(f => f * 2);

    That said, apparently I was blind, because finding that value converter property, there's actually an IsThumbToolTipEnabled property that lets you disable it.
    • Marked as answer by Tom Servo Monday, June 25, 2012 5:46 PM
    • Edited by Tom Servo Monday, June 25, 2012 5:46 PM
    Monday, June 25, 2012 5:44 PM

All replies

  • I just found out that WPF had a property called AutoTooltipPlacement, that allowed to disable this. Is there anything similar in WinRT?
    Monday, June 25, 2012 4:43 PM
  • Nevermind, there's actually a properly called ThumbToolTipValueConverter, to which you can a value converter to. In this case, I don't need to hide the tooltip. I'm now remapping the tooltip scale to the respective values it's supposed to represent.

    public class TooltipConverter : IValueConverter
    {
    	Func<double, double> _ranger;
    
    	public object Convert(object value, Type type, object parameter, string language)
    	{
    		double d = (double)value;
    		return _ranger(d);
    	}
    
    	public object ConvertBack(object value, Type type, object parameter, string language)
    	{
    		throw new NotSupportedException();
    	}
    
    	public TooltipConverter(Func<double, double> ranger)
    	{
    		_ranger = ranger;
    	}
    }
    
    
    // Magic
    someSlider.ThumbToolTipValueConverter = new TooltipConverter(f => f * 2);

    That said, apparently I was blind, because finding that value converter property, there's actually an IsThumbToolTipEnabled property that lets you disable it.
    • Marked as answer by Tom Servo Monday, June 25, 2012 5:46 PM
    • Edited by Tom Servo Monday, June 25, 2012 5:46 PM
    Monday, June 25, 2012 5:44 PM
  • Set Slider.IsThumbToolTipEnabled="False" if you need to hide the Slider Thumb's ToolTip, or use Slider.ThumbToolTipValueConverter to customize what it displays.
    • Proposed as answer by Pat Finnigan Monday, May 13, 2013 6:29 AM
    Monday, May 13, 2013 6:29 AM