Version

DateToDouble Converter

In Visual Basic:

Class DateToDoubleConverter
    Implements IValueConverter
    Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
       Dim temp As DateTime = System.Convert.ToDateTime(parameter)
       Return temp.ToOADate()
    End Function
    Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
        Throw New NotImplementedException()
    End Function
End Class

In C#:

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Data;
namespace Modifying_a_Date_Time_Axis
{
    class DateToDoubleConverter:IValueConverter
    {
        #region IValueConverter Members
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            DateTime temp = System.Convert.ToDateTime(parameter);
            return temp.ToOADate();
        }
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
        #endregion
    }
}