refactor: 将Framework库和RT、UI放在同一个解决方案中。
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace MECF.Framework.UI.Core.Converters
|
||||
{
|
||||
public class StringToDoubleConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
return double.NaN;
|
||||
|
||||
if (double.TryParse(value.ToString(), out var dbl))
|
||||
return dbl;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
return "";
|
||||
return value.ToString() ?? "";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user