需要使用值转换器IValueConverter,百度下它 的使用方式。类似下面这个
public class MyValueConverter:IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null) return null;
string sliderValue = value.ToString();
if (sliderValue == "1")
{
return "a";
}
if (sliderValue == "2")
{
return "b";
}
return "c";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}