Files
ADP/UIShare/Converters/LessThanConverter.cs
2026-06-05 10:57:09 +08:00

27 lines
891 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Globalization;
using System.Windows.Data;
namespace UIShare.Converters // 确保命名空间跟你项目一致
{
public class LessThanConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is double actualWidth && parameter != null)
{
if (double.TryParse(parameter.ToString(), out double targetWidth))
{
// 如果实际宽度 小于 设定的阈值比如600返回 True
return actualWidth < targetWidth;
}
}
return false;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}