加个Converter,把double转换成DateTime。- bind.Converter = new DateTimeConverter();
- bind.StringFormat = "x={0:yyyy/mm/dd}";
- bind.Path = new PropertyPath("DataPoint.X");
复制代码- public class DateTimeConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- DateTime result = DateTime.FromOADate((double)value);
- return result;
- }
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- return null;
- }
- }
复制代码 |