Last active
October 7, 2015 15:39
-
-
Save naotaco/007e752fd01493b521da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// somewhere | |
Slider.ThumbToolTipValueConverter = new SliderValueConverter() { Labels = new List<string>(){"a", "b", "c"} }; | |
} | |
public class SliderValueConverter : IValueConverter | |
{ | |
public List<string> Labels { get; set; } | |
public object Convert(object value, Type targetType, object parameter, string language) | |
{ | |
var selected = (int)Math.Round((double)value); | |
if (Labels == null || selected >= Labels.Count) { return value.ToString(); } | |
return Labels[selected]; | |
} | |
public object ConvertBack(object value, Type targetType, object parameter, string language) | |
{ | |
throw new NotImplementedException(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment