Skip to content

Commit

Permalink
Added a currency to string converter
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Munn committed Oct 29, 2012
1 parent 39ddb2e commit 57ca755
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions MonoKit/DataBinding/DecimalToStringConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,21 @@ public object ConvertBack (object value, Type targetType, object parameter, Syst
return System.Convert.ToDecimal((string)value);
}
}

public sealed class CurrencyToStringConverter : IValueConverter
{
public CurrencyToStringConverter()
{
}

public object Convert (object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return ((decimal)value).ToString("C");
}

public object ConvertBack (object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return System.Convert.ToDecimal((string)value);
}
}
}

0 comments on commit 57ca755

Please sign in to comment.