具备界面基础功能
This commit is contained in:
29
SHH.CameraDashboard/Converters/BoolToMaxScaleConverter.cs
Normal file
29
SHH.CameraDashboard/Converters/BoolToMaxScaleConverter.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user