Added resource classses and a missing converter.
This commit is contained in:
25
Harmonia.WinUI/Converters/DoubleToPercentConverter.cs
Normal file
25
Harmonia.WinUI/Converters/DoubleToPercentConverter.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user