Files
Ayay/SHH.CameraDashboard/Converters/BoolToMaxScaleConverter.cs

29 lines
843 B
C#
Raw Permalink Normal View History

2026-01-01 22:40:32 +08:00
using System.Globalization;
using System.Windows.Data;
namespace SHH.CameraDashboard;
/// <summary>
/// 布尔值转最大缩放比例转换器
/// </summary>
public class BoolToMaxScaleConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
// 如果 AllowExpand (value) 为 true
if (value is bool allow && allow)
{
// 允许放大:最大支持 200% (即放大 2 倍)
// 你也可以改成 300 或根据业务需求调整
return 200.0;
}
// 不允许放大:最大限制在 100% (原图大小)
return 100.0;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}