blob: bde1aee2fd81fb813a7c62f47f0dab5d2c2fdc7d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Markup;
namespace Xamarin.PropertyEditing.Windows
{
[ValueConversion (typeof (double), typeof (double))]
internal class DoubleToAngleConverter : MarkupExtension, IValueConverter
{
public object Convert (object value, Type targetType, object parameter, CultureInfo culture)
=> !(value is double doubleValue) ? DependencyProperty.UnsetValue
: doubleValue < 0 ? 0
: doubleValue > 360 ? 360
: doubleValue;
public object ConvertBack (object value, Type targetType, object parameter, CultureInfo culture)
=> Convert (value, targetType, parameter, culture);
public override object ProvideValue (IServiceProvider serviceProvider) => this;
}
}
|