回复 4楼CanYou1的帖子
更新了4楼示例中的代码,改了NullableCoverter类来满足你的需求,代码参考:
- public class NullableConverter : IValueConverter
- {
- #region IValueConverter Members
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value == null)
- {
- return double.NaN;
- }
- return value;
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value.Equals(double.NaN))
- {
- return null;
- }
- return value;
- }
- #endregion
- }
复制代码 |