Advertisement
PizzaCoder

Converters.cs

Nov 13th, 2015
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.65 KB | None | 0 0
  1. public class Checked : IMultiValueConverter
  2.     {
  3.        
  4.         public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  5.         {
  6.             var width = (double)values[0];
  7.             bool ischecked = (bool)values[1];
  8.             var height = (double)values[2];
  9.             if (ischecked)
  10.             {
  11.                 return 0;
  12.             }
  13.             else
  14.             {
  15.                 return width - height;
  16.             }
  17.         }
  18.  
  19.         public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
  20.         {
  21.             throw new NotImplementedException();
  22.         }
  23.     }
  24.     public class LessHeight : IValueConverter
  25.     {
  26.  
  27.         public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  28.         {
  29.             return 0.85 * (double)value;
  30.         }
  31.  
  32.         public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  33.         {
  34.             throw new NotImplementedException();
  35.         }
  36.     }
  37.     public class HalfRadius : IValueConverter
  38.     {
  39.  
  40.         public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  41.         {
  42.             return new CornerRadius((double)value / 2);
  43.             //return new CornerRadius(5000);
  44.         }
  45.  
  46.         public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  47.         {
  48.             throw new NotImplementedException();
  49.         }
  50.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement