SHARE
TWEET

Untitled

a guest Feb 11th, 2016 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     class ScalingConverter : IValueConverter
  2.     {
  3.         public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  4.         {
  5.             if (value == null || parameter == null)
  6.                 return DependencyProperty.UnsetValue;
  7.             double v = (double)value;
  8.             double p = (double)parameter;
  9.             return v * p;
  10.         }
  11.  
  12.         public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  13.         {
  14.             throw new NotSupportedException();
  15.         }
  16.     }
  17.  
  18.     public class DoubleExtension : TypedValueExtension<double>
  19.     {
  20.         public DoubleExtension(double value) : base(value) { }
  21.     }
  22.  
  23.     public class TypedValueExtension<T> : MarkupExtension
  24.     {
  25.         public TypedValueExtension(T value) { Value = value; }
  26.         public T Value { get; set; }
  27.         public override object ProvideValue(IServiceProvider sp) { return Value; }
  28.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top