Sic.Framework-Nanjing-Baishi/MECF.Framework.UI.Client/RecipeEditorLib/Converters/ParamToCellTooltipConverter.cs

31 lines
869 B
C#
Raw Normal View History

2023-04-13 11:51:03 +08:00
using System;
using System.Globalization;
using System.Windows.Data;
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
2023-04-13 11:51:03 +08:00
namespace MECF.Framework.UI.Client.RecipeEditorLib.Converters
2023-04-13 11:51:03 +08:00
{
public class ParamToCellTooltipConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!(value is IParam param))
return null;
if (!param.IsValid)
2023-04-13 11:51:03 +08:00
return param.ValidationError;
if (param is DoubleParam dblParam)
return $"{dblParam.Minimun} - {dblParam.Maximun}";
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}