功能更新
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Melskin.Converters.Internal;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[ValueConversion(typeof(double), typeof(Thickness))]
|
||||
internal class IntensityToSlotMarginConverter : IValueConverter
|
||||
{
|
||||
public static readonly IntensityToSlotMarginConverter Instance = new();
|
||||
|
||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
var intensity = (double)(value ?? 0);
|
||||
//边距越小,留下的边框越窄
|
||||
var uniformValue = 4 * intensity + 4;
|
||||
return new Thickness(uniformValue);
|
||||
}
|
||||
|
||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
return Binding.DoNothing;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user