Mercurial > silverbladetech
comparison MetroWpf/MetroWpf.Xaml/Converters/PercentToAngleConverter.cs @ 15:060f02cd4591
Initial commit, pre airport work
author | stevenh7776 stevenhollidge@hotmail.com |
---|---|
date | Mon, 12 Mar 2012 23:05:21 +0800 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
14:741981715d94 | 15:060f02cd4591 |
---|---|
1 using System; | |
2 using System.Globalization; | |
3 using System.Windows; | |
4 using System.Windows.Data; | |
5 | |
6 namespace MetroWpf.Xaml.Converters | |
7 { | |
8 public sealed class PercentToAngleConverter : IValueConverter | |
9 { | |
10 public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |
11 { | |
12 if (!(value is double)) | |
13 { | |
14 return DependencyProperty.UnsetValue; | |
15 } | |
16 return (double)value * 360.0; | |
17 } | |
18 | |
19 public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |
20 { | |
21 if (!(value is double)) | |
22 { | |
23 return DependencyProperty.UnsetValue; | |
24 } | |
25 return (double)value * (1.0 / 360.0); | |
26 } | |
27 } | |
28 } ; |