using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace Melskin.Converters.Internal
{
///
/// 数字转换为圆角转换器
///
public class DoubleToCornerRadiusConverter : IValueConverter
{
///
/// 单例
///
public static readonly DoubleToCornerRadiusConverter Instance = new();
///
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (double.TryParse(value?.ToString(),out double result))
{
return new CornerRadius(result);
}
return new CornerRadius();
}
///
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}