Update ColorPickerVerticalSlider.cs

This commit is contained in:
Wiesław Šoltés 2022-08-13 14:55:29 +02:00
Родитель 75897278a3
Коммит cc87e2df9c
1 изменённых файлов: 14 добавлений и 2 удалений

Просмотреть файл

@ -136,12 +136,24 @@ public class ColorPickerVerticalSlider : TemplatedControl
private T? Convert<T>(IValueConverter converter, T? value, T? range)
{
return (T?)converter.Convert(value, typeof(T), range, CultureInfo.CurrentCulture);
var converted = converter.Convert(value, typeof(T), range, CultureInfo.CurrentCulture);
if (converted == AvaloniaProperty.UnsetValue)
{
return default;
}
var result = (T?)converted;
return result;
}
private T? ConvertBack<T>(IValueConverter converter, T? value, T? range)
{
return (T?)converter.ConvertBack(value, typeof(T), range, CultureInfo.CurrentCulture);
var converted = converter.ConvertBack(value, typeof(T), range, CultureInfo.CurrentCulture);
if (converted == AvaloniaProperty.UnsetValue)
{
return default;
}
var result = (T?)converted;
return result;
}
private void UpdateValuesFromThumbs()