31 lines
826 B
C#
31 lines
826 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Data;
|
|
|
|
namespace FasdDesktopUi.Basics.Converter
|
|
{
|
|
public class PercentToDecimalConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (value is int percent)
|
|
return percent / 100.0;
|
|
else
|
|
return null;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (value is double doubleValue)
|
|
return doubleValue * 100;
|
|
|
|
else
|
|
return null;
|
|
}
|
|
}
|
|
}
|