Use UsdExchangeRate as ToProperty
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/SendTabView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/SendTabView.xaml
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="10">
<Button Content="{Binding IsMax, Converter={StaticResource BooleanStringConverter}, ConverterParameter=Clear:Max}" Command="{Binding MaxCommand}" VerticalAlignment="Top" Height="40" />
- <controls:ExtendedTextBox Foreground="{Binding AmountText,
- Converter={StaticResource AmountForegroundConverter}}"
- IsReadOnly="{Binding IsMax}" Text="{Binding AmountText}"
+ <controls:ExtendedTextBox Foreground="{Binding AmountText, Converter={StaticResource AmountForegroundConverter}}"
+ IsReadOnly="{Binding IsMax}" Text="{Binding AmountText, Mode=TwoWay}"
ToolTip.Tip="{Binding AmountToolTip}"
Watermark="{Binding AmountWatermarkText}"
UseFloatingWatermark="True"

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
@@ -45,7 +45,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private Money _estimatedBtcFee;
private Money _satoshiPerByteFeeRate;
private decimal _feePercentage;
- private decimal _usdExchangeRate;
+ private ObservableAsPropertyHelper<decimal> _usdExchangeRate;
private Money _allSelectedAmount;
private string _password;
private string _address;
@@ -873,11 +873,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
set => this.RaiseAndSetIfChanged(ref _feePercentage, value);
}
- public decimal UsdExchangeRate
- {
- get => _usdExchangeRate;
- set => this.RaiseAndSetIfChanged(ref _usdExchangeRate, value);
- }
+ public decimal UsdExchangeRate => _usdExchangeRate?.Value ?? 0m;
public Money AllSelectedAmount
{
@@ -1043,17 +1039,14 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
SetFeesAndTexts();
}).DisposeWith(Disposables);
- Global.Synchronizer.WhenAnyValue(x => x.UsdExchangeRate).Subscribe(_ =>
- {
- var exchangeRate = Global.Synchronizer.UsdExchangeRate;
-
- if (exchangeRate != 0)
- {
- UsdExchangeRate = exchangeRate;
- }
+ _usdExchangeRate = Global.Synchronizer
+ .WhenAnyValue(x => x.UsdExchangeRate)
+ .ToProperty(this, x => x.UsdExchangeRate, scheduler: RxApp.MainThreadScheduler)
+ .DisposeWith(Disposables);
- SetFeesAndTexts();
- }).DisposeWith(Disposables);
+ this.WhenAnyValue(x => x.UsdExchangeRate)
+ .ObserveOn(RxApp.MainThreadScheduler)
+ .Subscribe(_ => SetFeesAndTexts());
base.OnOpen();
}

Use UsdExchangeRate as ToProperty