blob: ad1155f99ca877e5ce306bffc99f633fa2f121dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
using System;
using System.Globalization;
using System.Windows.Data;
namespace Tango.Touch.Converters
{
public class RotateTransformConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
var value = values[0].ExtractDouble();
var minimum = values[1].ExtractDouble();
var maximum = values[2].ExtractDouble();
if (new[] { value, minimum, maximum }.AnyNan())
return Binding.DoNothing;
var percent = maximum <= minimum ? 1.0 : (value - minimum) / (maximum - minimum);
return 360*percent;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
|