amounts format
MODIFY
WalletWasabi.Fluent/Converters/MoneyConverters.cs
WalletWasabi.Fluent/Converters/MoneyConverters.cs
+using System;
using Avalonia.Data.Converters;
using NBitcoin;
@@ -11,5 +12,30 @@ namespace WalletWasabi.Fluent.Converters
null => "Unknown",
{ } => x.ToString(fplus: false, trimExcessZero: true),
});
+
+ public static readonly IValueConverter ToFormattedString =
+ new FuncValueConverter<Money?, string>(money =>
+ {
+ if (money is null)
+ {
+ return "";
+ }
+
+ var moneyString = money.ToString();
+
+ moneyString = moneyString.Insert(moneyString.Length - 4, " ");
+
+ var startIndex = moneyString.IndexOf(".", StringComparison.Ordinal) - 3;
+
+ if (startIndex > 0)
+ {
+ for (var i = startIndex; i > 0; i -= 3)
+ {
+ moneyString = moneyString.Insert(i, " ");
+ }
+ }
+
+ return moneyString;
+ });
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryItemViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryItemViewModel.cs
@@ -22,11 +22,13 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.History
var amount = transactionSummary.Amount;
if (amount < 0)
{
- OutgoingAmount = (amount * -1).ToString();
+ // OutgoingAmount = amount * -1;
+ OutgoingAmount = (amount * -1) + Money.FromUnit(new Random().Next(0,2000), MoneyUnit.BTC);
}
else
{
- IncomingAmount = amount.ToString();
+ // IncomingAmount = amount;
+ IncomingAmount = amount + Money.FromUnit(new Random().Next(0, 2000), MoneyUnit.BTC);
}
}
@@ -40,9 +42,9 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.History
public bool IsConfirmed { get; }
- public string? IncomingAmount { get; }
+ public Money? IncomingAmount { get; }
- public string? OutgoingAmount { get; }
+ public Money? OutgoingAmount { get; }
public bool IsCoinJoin { get; }
}

MODIFY
WalletWasabi.Fluent/Views/Wallets/Home/History/HistoryTable.axaml
WalletWasabi.Fluent/Views/Wallets/Home/History/HistoryTable.axaml
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:history="clr-namespace:WalletWasabi.Fluent.ViewModels.Wallets.Home.History"
+ xmlns:converters="clr-namespace:WalletWasabi.Fluent.Converters"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:DataType="history:HistoryViewModel"
x:CompileBindings="True"
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel x:DataType="history:HistoryItemViewModel"
- IsVisible="{Binding !!IncomingAmount}">
+ IsVisible="{Binding !!IncomingAmount}"
+ HorizontalAlignment="Right">
<PathIcon Data="{StaticResource arrow_down_right_regular}" Opacity="0.6" />
- <TextBlock Classes="monoSpaced" FontFamily="{StaticResource MonospacedFont}" Text="{Binding IncomingAmount}" />
+ <TextBlock Classes="monoSpaced" Text="{Binding IncomingAmount, Converter={x:Static converters:MoneyConverters.ToFormattedString}}" />
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel x:DataType="history:HistoryItemViewModel"
- IsVisible="{Binding !!OutgoingAmount}">
+ IsVisible="{Binding !!OutgoingAmount}"
+ HorizontalAlignment="Right">
<PathIcon Data="{StaticResource arrow_up_right_regular}" Opacity="0.6" />
- <TextBlock Classes="monoSpaced" Text="{Binding OutgoingAmount}" />
+ <TextBlock Classes="monoSpaced" Text="{Binding OutgoingAmount, Converter={x:Static converters:MoneyConverters.ToFormattedString}}" />
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
SortMemberPath="Balance">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
- <StackPanel>
+ <StackPanel HorizontalAlignment="Right">
<Viewbox Height="20" Width="20">
<Panel>
<Ellipse Stroke="{DynamicResource TextControlForeground}" StrokeThickness="4" Height="115"
<PathIcon Data="{StaticResource btc_logo}" Height="50" Width="50" Opacity="0.6" />
</Panel>
</Viewbox>
- <TextBlock Classes="monoSpaced" x:DataType="history:HistoryItemViewModel" Text="{Binding Balance}" />
+ <TextBlock Classes="monoSpaced" x:DataType="history:HistoryItemViewModel" Text="{Binding Balance, Converter={x:Static converters:MoneyConverters.ToFormattedString}}" />
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>

amounts format