Copy displayed USD figure
MODIFY
WalletWasabi.Fluent/Converters/MoneyConverters.cs
WalletWasabi.Fluent/Converters/MoneyConverters.cs
-using System.Collections.Generic;
-using System.Globalization;
using Avalonia.Data.Converters;
using NBitcoin;
using WalletWasabi.Fluent.Extensions;
@@ -11,6 +9,9 @@ public static class MoneyConverters
public static readonly IValueConverter ToUsd =
new FuncValueConverter<decimal, string>(n => n.ToUsd());
+ public static readonly IValueConverter ToUsdNumber =
+ new FuncValueConverter<decimal, string>(n => n.ToUsdAmount());
+
public static readonly IValueConverter ToUsdAproxBetweenParens =
new FuncValueConverter<decimal, string>(n => n.ToUsdAproxBetweenParens());

MODIFY
WalletWasabi.Fluent/Extensions/CurrencyExtensions.cs
WalletWasabi.Fluent/Extensions/CurrencyExtensions.cs
@@ -48,13 +48,16 @@ public static class CurrencyExtensions
public static string ToUsd(this decimal n)
{
- var amountPart = n switch
+ return ToUsdAmount(n) + " USD";
+ }
+
+ public static string ToUsdAmount(this decimal n)
+ {
+ return n switch
{
>= 10 => Math.Ceiling(n).ToString("N0", FormatInfo),
>= 1 => n.ToString("N1", FormatInfo),
_ => n.ToString("N2", FormatInfo)
};
-
- return amountPart + " USD";
}
}

MODIFY
WalletWasabi.Fluent/Views/Wallets/Home/Tiles/WalletBalanceTileView.axaml
WalletWasabi.Fluent/Views/Wallets/Home/Tiles/WalletBalanceTileView.axaml
Content="{Binding BalanceBtc^, Converter={x:Static converters:MoneyConverters.ToBtc}}" />
</c:CopyableItem>
<c:TileControl.BottomContent>
- <c:CopyableItem ContentToCopy="{Binding BalanceFiat^}" HorizontalContentAlignment="Center">
+ <c:CopyableItem ContentToCopy="{Binding BalanceFiat^, Converter={x:Static converters:MoneyConverters.ToUsdNumber}}" HorizontalContentAlignment="Center">
<c:PrivacyContentControl Classes="bold monoSpaced" Margin="4" VerticalAlignment="Center"
Opacity="0.8"
Content="{Binding BalanceFiat^, Converter={x:Static converters:MoneyConverters.ToUsdAproxBetweenParens}}" />

Copy displayed USD figure