DualCurrencyEntryBox - readonly template and visual fixes
MODIFY
WalletWasabi.Fluent/Controls/CurrencyEntryBox.axaml
WalletWasabi.Fluent/Controls/CurrencyEntryBox.axaml
<Setter Property="Foreground" Value="{DynamicResource TextControlPlaceholderForegroundFocused}" />
</Style>
- <Style Selector="c|CurrencyEntryBox:focus /template/ Border#PART_BorderElement">
+ <!--<Style Selector="c|CurrencyEntryBox:focus /template/ Border#PART_BorderElement">
<Setter Property="Background" Value="{DynamicResource TextControlBackgroundFocused}" />
<Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushFocused}" />
<Setter Property="BorderThickness" Value="{DynamicResource TextControlBorderThemeThicknessFocused}" />
- </Style>
+ </Style>-->
</Styles>

MODIFY
WalletWasabi.Fluent/Controls/CurrencyEntryBox.axaml.cs
WalletWasabi.Fluent/Controls/CurrencyEntryBox.axaml.cs
@@ -274,4 +274,18 @@ public class CurrencyEntryBox : TextBox
return "";
}
+
+ protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T> change)
+ {
+ base.OnPropertyChanged(change);
+
+ if (change.Property == IsReadOnlyProperty)
+ {
+ PseudoClasses.Set(":readonly", change.NewValue.GetValueOrDefault<bool>());
+ }
+ else if (change.Property == ConversionRateProperty)
+ {
+ PseudoClasses.Set(":noexchangerate", change.NewValue.GetValueOrDefault<decimal>() == 0m);
+ }
+ }
}

MODIFY
WalletWasabi.Fluent/Controls/DualCurrencyEntryBox.axaml.cs
WalletWasabi.Fluent/Controls/DualCurrencyEntryBox.axaml.cs
@@ -255,7 +255,7 @@ public class DualCurrencyEntryBox : UserControl
var conversion = BitcoinToFiat(AmountBtc);
- IsConversionApproximate = !IsConversionReversed && AmountBtc > 0;
+ IsConversionApproximate = AmountBtc > 0;
Watermark = FullFormatBtc(0);
ConversionWatermark = FullFormatFiat(0, ConversionCurrencyCode, false);
@@ -372,11 +372,15 @@ public class DualCurrencyEntryBox : UserControl
if (IsConversionReversed)
{
+ _leftEntryBox.HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Right;
+ _rightEntryBox.HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Stretch;
grid?.Children.Add(_rightEntryBox);
grid?.Children.Add(_leftEntryBox);
}
else
{
+ _leftEntryBox.HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Stretch;
+ _rightEntryBox.HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Right;
grid?.Children.Add(_leftEntryBox);
grid?.Children.Add(_rightEntryBox);
}

DualCurrencyEntryBox - readonly template and visual fixes