VPet/VPet-Simulator.Windows/Design/Converters/DiscountPriceConverter.cs
2023-06-05 16:42:20 +08:00

24 lines
701 B
C#

using System;
using System.Globalization;
using System.Windows.Data;
namespace VPet_Simulator.Windows
{
public class DiscountPriceConverter
: IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
var price = (double)values[0];
var discount = (int)values[1];
var discountPrice = (price * (discount / 100d));
return $"¥ {discountPrice.ToString("0.0")}";
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}