This commit is contained in:
NaBian committed 2019-11-02 23:37:15 +08:00
1 parent 8729d6ecf8
commit 418530b53a
19 files changed
+238 -149

No files matched your search

@@ -0,0 +1,29 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace HandyControl.Tools.Converter
{
public class Double2GridLengthConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is double doubleValue)
{
if (double.IsNaN(doubleValue) || double.IsInfinity(doubleValue))
{
return new GridLength(1.0, GridUnitType.Star);
}
return new GridLength(doubleValue);
}
return new GridLength(0);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}