Add tile layout flags
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Home/Tiles/TileViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Home/Tiles/TileViewModel.cs
@@ -6,13 +6,27 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.Tiles
{
public abstract partial class TileViewModel : ActivatableViewModel
{
+ private readonly int _smallLayoutIndex;
+ private readonly int _normalLayoutIndex;
+ private readonly int _wideLayoutIndex;
[AutoNotify] private ObservableCollection<TilePresetViewModel>? _tilePresets;
[AutoNotify] private int _tilePresetIndex;
+ [AutoNotify(SetterModifier = AccessModifier.Private)] private bool _isSmallLayout;
+ [AutoNotify(SetterModifier = AccessModifier.Private)] private bool _isNormalLayout;
+ [AutoNotify(SetterModifier = AccessModifier.Private)] private bool _isWideLayout;
protected TileViewModel()
{
+ _smallLayoutIndex = 0;
+ _normalLayoutIndex = 1;
+ _wideLayoutIndex = 2;
+
this.WhenAnyValue(x => x.TilePresetIndex)
- .Subscribe(_ => NotifyPresetChanged());
+ .Subscribe(x =>
+ {
+ SetLayoutFlag(x);
+ NotifyPresetChanged();
+ });
}
public int Column => CurrentTilePreset?.Column ?? 0;
@@ -36,5 +50,12 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.Tiles
this.RaisePropertyChanged(nameof(RowSpan));
this.RaisePropertyChanged(nameof(IsVisible));
}
+
+ private void SetLayoutFlag(int layoutIndex)
+ {
+ IsSmallLayout = layoutIndex == _smallLayoutIndex;
+ IsNormalLayout = layoutIndex == _normalLayoutIndex;
+ IsWideLayout = layoutIndex == _wideLayoutIndex;
+ }
}
}
\ No newline at end of file

Add tile layout flags