Skip to content

Instantly share code, notes, and snippets.

@cerebrate
Created February 25, 2013 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cerebrate/5030215 to your computer and use it in GitHub Desktop.
Save cerebrate/5030215 to your computer and use it in GitHub Desktop.
The so-obvious-you-d-think-it'd-be-in-the-library value converter used in binding a control to something-a-specific-bit-less-than-the-size-of-its-parent.
public class SubtractConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
return (double)value - System.Convert.ToDouble(parameter);
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
return (double)value + System.Convert.ToDouble(parameter);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment