27 lines
757 B
27 lines
757 B
using System;
|
|
using System.Globalization;
|
|
using System.Windows.Data;
|
|
|
|
namespace BBWY.Client.Converters
|
|
{
|
|
public class WidthConveter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (value is double)
|
|
{
|
|
double.TryParse(parameter?.ToString(), out double p);
|
|
var width = (double)value;
|
|
if (width == 0)
|
|
return 0;
|
|
return width - p;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|
|
|