Files
qhmes/yy-admin-master/YY.Admin.Core/Converter/MaxWidthConverter.cs

24 lines
750 B
C#

using System.Globalization;
using System.Windows.Data;
namespace YY.Admin.Core.Converter
{
public class MaxWidthConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is double totalWidth && totalWidth > 0 && parameter != null && double.TryParse(parameter.ToString(), out var offset) && totalWidth >= offset)
{
// 最大宽度
return totalWidth - offset;
}
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}