flip scrollbar WPF

前端 未结 3 1248
深忆病人
深忆病人 2021-01-21 00:46

Hi I am building a control that shows a ruler from 0 to a maximum. The 0 value is at the bottom and the maximum is in a higher y then the 0(The maximum is not visible until we s

3条回答
  •  [愿得一人]
    2021-01-21 01:24

    How about using a value converter to negate your Minimum, Maximum and Value properties. That way the scrollbar will act as though you flipped it.

    code:

    class NegativeValueConverter : IValueConverter
    {
      object Convert(object value, ...)
      {
        return -System.Convert.ToDouble(value);
      }
    
      object ConvertBack(object value, ...)
      {
        return -System.Convert.ToDouble(value);
      }
    }
    

    xaml:

    
      
    
    
    

提交回复
热议问题