public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
TimeSpan time = (TimeSpan)value;
int totalMinutes = 0;
int seconds = 0;
string prefix = "";
if (time != null)
{
seconds = Math.Abs(time.Seconds);
if (time.Ticks >= 0)
{
totalMinutes = (int)Math.Floor(time.TotalMinutes);
}
else
{
totalMinutes = (int)Math.Ceiling(time.TotalMinutes);
prefix = "-";
}
totalMinutes = Math.Abs(totalMinutes);
}
return prefix + String.Format("{0}:{1:D2}", totalMinutes, seconds);
}