using System.Globalization; using System.Windows.Data; namespace EonaCat.VolumeMixer.Tester.WPF.Converter { // This file is part of the EonaCat project(s) which is released under the Apache License. // See the LICENSE file or go to https://EonaCat.com/License for full license details. public class VolumeToPercentageConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is float volume) { return $"{Math.Round(volume * 100)}%"; } return "0%"; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }