Skip to content

Commit

Permalink
Feat: Added thousand separator in footer for Edited and Inspected (#10)
Browse files Browse the repository at this point in the history
* Added thousand separator for `PercentageCoverageConverter`

* Added space between number and bracket in zero case
Changed `string` to `var`
  • Loading branch information
Myszax authored May 13, 2024
1 parent 8234720 commit d8a5627
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions WPFUI/Converters/PercentageCoverageConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public sealed class PercentageCoverageConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
string zero = $"0({0:N2})%";
var zero = $"0 ({0:N2})%";

if (values.Length != 2 || values[0] is not int || values[1] is not int)
return zero;
Expand All @@ -20,7 +20,7 @@ public object Convert(object[] values, Type targetType, object parameter, Cultur
var currentAmount = (int)values[0];
var percentageValue = decimal.Divide(currentAmount, totalAmount) * 100;

return $"{currentAmount}({percentageValue:N2}%)";
return string.Create(CultureInfo.InvariantCulture, $"{currentAmount:N0} ({percentageValue:N2}%)");
}

public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
Expand Down

0 comments on commit d8a5627

Please sign in to comment.