using Microsoft.UI.Xaml.Data;
using System;

namespace Harmonia.WinUI.Converters;

public sealed partial class DoubleToPercentConverter : IValueConverter
{
    public DoubleToPercentConverter()
    {

    }

    public object? Convert(object value, Type targetType, object parameter, string language)
    {
        if (value is not double doubleValue)
            return null;

        return Math.Round(doubleValue * 100) + "%";
    }

    public object ConvertBack(object value, Type targetType, object parameter, string language)
    {
        throw new NotImplementedException();
    }
}