23 lines
630 B
C#
23 lines
630 B
C#
using System.Globalization;
|
|
using System.Windows.Data;
|
|
|
|
namespace EonaCat.VolumeMixer.Tester.WPF.Converter
|
|
{
|
|
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();
|
|
}
|
|
}
|
|
}
|