[skip ci] Coinlist column header redesign
MODIFY
WalletWasabi.Gui/Controls/SortingArrow.cs
WalletWasabi.Gui/Controls/SortingArrow.cs
@@ -26,35 +26,54 @@ namespace WalletWasabi.Gui.Controls
Type IStyleable.StyleKey => typeof(Button);
static readonly Geometry UpArrow = Geometry.Parse("M13.889,11.611c-0.17,0.17-0.443,0.17-0.612,0l-3.189-3.187l-3.363,3.36c-0.171,0.171-0.441,0.171-0.612,0c-0.172-0.169-0.172-0.443,0-0.611l3.667-3.669c0.17-0.17,0.445-0.172,0.614,0l3.496,3.493C14.058,11.167,14.061,11.443,13.889,11.611 M18.25,10c0,4.558-3.693,8.25-8.25,8.25c-4.557,0-8.25-3.692-8.25-8.25c0-4.557,3.693-8.25,8.25-8.25C14.557,1.75,18.25,5.443,18.25,10 M17.383,10c0-4.07-3.312-7.382-7.383-7.382S2.618,5.93,2.618,10S5.93,17.381,10,17.381S17.383,14.07,17.383,10");
static readonly Geometry DownArrow = Geometry.Parse("M13.962,8.885l-3.736,3.739c-0.086,0.086-0.201,0.13-0.314,0.13S9.686,12.71,9.6,12.624l-3.562-3.56C5.863,8.892,5.863,8.611,6.036,8.438c0.175-0.173,0.454-0.173,0.626,0l3.25,3.247l3.426-3.424c0.173-0.172,0.451-0.172,0.624,0C14.137,8.434,14.137,8.712,13.962,8.885 M18.406,10c0,4.644-3.763,8.406-8.406,8.406S1.594,14.644,1.594,10S5.356,1.594,10,1.594S18.406,5.356,18.406,10 M17.521,10c0-4.148-3.373-7.521-7.521-7.521c-4.148,0-7.521,3.374-7.521,7.521c0,4.147,3.374,7.521,7.521,7.521C14.148,17.521,17.521,14.147,17.521,10");
- static readonly Geometry NoArrow = Geometry.Parse("M10,0.562c-5.195,0-9.406,4.211-9.406,9.406c0,5.195,4.211,9.406,9.406,9.406c5.195,0,9.406-4.211,9.406-9.406C19.406,4.774,15.195,0.562,10,0.562 M10,18.521c-4.723,0-8.551-3.829-8.551-8.552S5.277,1.418,10,1.418s8.552,3.828,8.552,8.551S14.723,18.521,10,18.521");
Path _iconPath;
+ TextBlock _textBox;
public SortingArrow()
{
- MinWidth = 15;
- MinHeight = 15;
- Background = Brushes.Transparent;
- BorderBrush = Brushes.Transparent;
+ HorizontalContentAlignment = Avalonia.Layout.HorizontalAlignment.Stretch;
_iconPath = new Path()
{
- Data = NoArrow,
Stretch = Stretch.Fill,
- Stroke = Brushes.Gray,
- StrokeThickness = 1,
+ Stroke = (IBrush)Application.Current.Resources["ApplicationAccentForegroundBrush"],
+ StrokeThickness = 0.8,
Width = 10,
- Height = 10
+ Height = 10,
+ Margin = new Thickness(7, 0),
+ HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Right
+ };
+ _textBox = new TextBlock();
+
+ Grid stackPnl = new Grid()
+ {
+ Children =
+ {
+ new StackPanel()
+ {
+ Orientation = Orientation.Horizontal, HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Left,
+ Children = { _textBox }
+ },
+ new StackPanel()
+ {
+ Orientation = Orientation.Horizontal, HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Right,
+ Children =
+ {
+ _iconPath,
+ new Line() {StartPoint = new Point(0, 0), EndPoint = new Point(0, 20), StrokeThickness = 1, Stroke = Brushes.White } }
+ }
+ }
};
- Canvas stackPnl = new Canvas();
- stackPnl.Children.Add(_iconPath);
- stackPnl.Width = 10;
- stackPnl.Height = 10;
Content = stackPnl;
this.GetObservable(SortDirectionProperty).Subscribe(x =>
{
SortDirection = x;
});
+ this.GetObservable(TextProperty).Subscribe(x =>
+ {
+ Text = x;
+ });
}
protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
@@ -92,12 +111,25 @@ namespace WalletWasabi.Gui.Controls
}
}
+ public static readonly StyledProperty<string> TextProperty =
+AvaloniaProperty.Register<SortingArrow, string>(nameof(Text), defaultBindingMode: BindingMode.TwoWay);
+
+ public string Text
+ {
+ get => GetValue(TextProperty);
+ set
+ {
+ SetValue(TextProperty, value);
+ _textBox.Text = value;
+ }
+ }
+
private void RefreshArrowIcon()
{
switch (SortDirection)
{
case SortOrder.None:
- _iconPath.Data = NoArrow;
+ _iconPath.Data = Geometry.Parse("");
break;
case SortOrder.Increasing:
_iconPath.Data = DownArrow;

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinListView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/CoinListView.xaml
</i:Interaction.Behaviors>
<Grid IsSharedSizeScope="True">
<DockPanel LastChildFill="True">
- <Grid Margin="30 0" DockPanel.Dock="Top">
+ <Grid Margin="30 0 0 0" DockPanel.Dock="Top">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30" />
<ColumnDefinition Width="30" />
<ColumnDefinition SharedSizeGroup="A" Width="{Binding CoinJoinStatusWidth, Mode=OneWay}" />
- <ColumnDefinition Width="120" />
+ <ColumnDefinition Width="130" />
<ColumnDefinition Width="100" />
- <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="" Width="0" />
<TextBlock Text="" Grid.Column="1" />
- <StackPanel Grid.Column="2" Margin="10 0 0 0" Orientation="Horizontal">
- <TextBlock Text="Status"/>
- <controls:SortingArrow SortDirection="{Binding StatusSortDirection} "/>
- </StackPanel>
- <StackPanel Grid.Column="3" Margin="10 0 0 0" Orientation="Horizontal">
- <TextBlock Text="Amount (BTC)"/>
- <controls:SortingArrow SortDirection="{Binding AmountSortDirection}"/>
- </StackPanel>
- <StackPanel Grid.Column="4" Margin="20 0 0 0" Orientation="Horizontal">
- <TextBlock Text="Privacy"/>
- <controls:SortingArrow SortDirection="{Binding PrivacySortDirection}"/>
- </StackPanel>
- <TextBlock Text="History" Grid.Column="5" />
+
+ <controls:SortingArrow Grid.Column="2" Text="Status" SortDirection="{Binding StatusSortDirection} "/>
+
+ <controls:SortingArrow Grid.Column="3" Text="Amount (BTC)" SortDirection="{Binding AmountSortDirection}"/>
+
+ <controls:SortingArrow Grid.Column="4" Text="Privacy" SortDirection="{Binding PrivacySortDirection}"/>
+
+ <controls:SortingArrow Grid.Column="5" Text="History" SortDirection="{Binding HistorySortDirection}"/>
+
</Grid>
<StackPanel Margin="0 10 0 0" Spacing="10" DockPanel.Dock="Bottom" Orientation="Horizontal" >
<CheckBox Content = "Select All" IsThreeState="True" IsChecked = "{Binding SelectAllCheckBoxState}" Command="{Binding SelectAllCheckBoxCommand}" ToolTip.Tip="Select All"/>
<ColumnDefinition Width="30" />
<ColumnDefinition Width="30" />
<ColumnDefinition SharedSizeGroup="A" />
- <ColumnDefinition Width="113" />
+ <ColumnDefinition Width="123" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
@@ -25,6 +25,8 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private bool? _selectPrivateCheckBoxState;
private bool? _selectNonPrivateCheckBoxState;
private GridLength _coinJoinStatusWidth;
+ private SortOrder _historySortDirection;
+
public ReactiveCommand EnqueueCoin { get; }
public ReactiveCommand DequeueCoin { get; }
public ReactiveCommand SelectAllCheckBoxCommand { get; }
@@ -67,6 +69,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
{
AmountSortDirection = SortOrder.None;
PrivacySortDirection = SortOrder.None;
+ HistorySortDirection = SortOrder.None;
}
switch (value)
@@ -92,6 +95,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
{
PrivacySortDirection = SortOrder.None;
StatusSortDirection = SortOrder.None;
+ HistorySortDirection = SortOrder.None;
}
switch (value)
@@ -117,6 +121,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
{
AmountSortDirection = SortOrder.None;
StatusSortDirection = SortOrder.None;
+ HistorySortDirection = SortOrder.None;
}
switch (value)
@@ -132,6 +137,32 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
}
+ public SortOrder HistorySortDirection
+ {
+ get => _historySortDirection;
+ set
+ {
+ this.RaiseAndSetIfChanged(ref _historySortDirection, value);
+ if (value != SortOrder.None)
+ {
+ AmountSortDirection = SortOrder.None;
+ StatusSortDirection = SortOrder.None;
+ PrivacySortDirection = SortOrder.None;
+ }
+
+ switch (value)
+ {
+ case SortOrder.Increasing:
+ Coins = _rootcoinlist.CreateDerivedCollection(x => x, x => true, (x, y) => string.Compare(x.History, y.History, StringComparison.Ordinal));
+ break;
+
+ case SortOrder.Decreasing:
+ Coins = _rootcoinlist.CreateDerivedCollection(x => x, x => true, (x, y) => string.Compare(y.History, x.History, StringComparison.Ordinal));
+ break;
+ }
+ }
+ }
+
public bool? SelectNonPrivateCheckBoxState
{
get => _selectNonPrivateCheckBoxState;

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabView.xaml
</Grid>
</Grid>
<DockPanel LastChildFill="True" DockPanel.Dock="Bottom">
- <Grid ColumnDefinitions="40, 160, 100, *" Margin="10 0" DockPanel.Dock="Top">
+ <Grid ColumnDefinitions="40, 160, 150, *" Margin="10 0 0 0" DockPanel.Dock="Top">
<TextBlock Text="" />
- <TextBlock Text="Date" Grid.Column="1" />
- <TextBlock Text="Amount (BTC)" Grid.Column="2" />
- <TextBlock Text="Transaction ID" Grid.Column="3" Margin="20 0 0 0" />
+ <controls:SortingArrow Grid.Column="1" Text="Date" SortDirection="{Binding DateSortDirection}"/>
+ <controls:SortingArrow Grid.Column="2" Text="Amount (BTC)" SortDirection="{Binding AmountSortDirection}"/>
+ <controls:SortingArrow Grid.Column="3" Text="Transaction ID" SortDirection="{Binding TransactionSortDirection}"/>
</Grid>
<ListBox Items="{Binding Transactions}" SelectedItem="{Binding SelectedTransaction, Mode=TwoWay}">
<ListBox.ItemTemplate>
<DataTemplate>
- <Grid ColumnDefinitions="40, 160, 100, *">
+ <Grid ColumnDefinitions="40, 160, 150, *">
<Grid.Styles>
<Style Selector="TextBlock">
<Setter Property="VerticalAlignment" Value="Center" />
</Border>
<TextBlock Text="{Binding DateTime}" Grid.Column="1" />
<TextBlock Text="{Binding AmountBtc}" Grid.Column="2" Foreground="{Binding AmountBtc, Converter={StaticResource MoneyBrushConverter}}" />
- <TextBlock Text="{Binding TransactionId}" Grid.Column="3" Margin="20 0 0 0" />
+ <TextBlock Text="{Binding TransactionId}" Grid.Column="3" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabViewModel.cs
@@ -25,6 +25,9 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private double _clipboardNotificationOpacity;
private bool _clipboardNotificationVisible;
private long _disableClipboard;
+ private SortOrder _dateSortDirection;
+ private SortOrder _amountSortDirection;
+ private SortOrder _transactionSortDirection;
public HistoryTabViewModel(WalletViewModel walletViewModel)
: base("History", walletViewModel)
@@ -68,6 +71,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
Interlocked.Exchange(ref _disableClipboard, 0);
}
});
+ DateSortDirection = SortOrder.Decreasing;
}
private void RewriteTable()
@@ -164,6 +168,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
SelectedTransaction = txToSelect;
}
}
+ RefreshOrdering();
}
public ObservableCollection<TransactionViewModel> Transactions
@@ -189,5 +194,91 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
get { return _clipboardNotificationVisible; }
set { this.RaiseAndSetIfChanged(ref _clipboardNotificationVisible, value); }
}
+
+ public SortOrder DateSortDirection
+ {
+ get => _dateSortDirection;
+ set
+ {
+ this.RaiseAndSetIfChanged(ref _dateSortDirection, value);
+ if (value != SortOrder.None)
+ {
+ AmountSortDirection = SortOrder.None;
+ TransactionSortDirection = SortOrder.None;
+ }
+ RefreshOrdering();
+
+ }
+ }
+ public SortOrder AmountSortDirection
+ {
+ get => _amountSortDirection;
+ set
+ {
+ this.RaiseAndSetIfChanged(ref _amountSortDirection, value);
+ if (value != SortOrder.None)
+ {
+ DateSortDirection = SortOrder.None;
+ TransactionSortDirection = SortOrder.None;
+ }
+ RefreshOrdering();
+ }
+ }
+ public SortOrder TransactionSortDirection
+ {
+ get => _transactionSortDirection;
+ set
+ {
+ this.RaiseAndSetIfChanged(ref _transactionSortDirection, value);
+ if (value != SortOrder.None)
+ {
+ AmountSortDirection = SortOrder.None;
+ DateSortDirection = SortOrder.None;
+ }
+ RefreshOrdering();
+ }
+ }
+ void RefreshOrdering()
+ {
+ if (TransactionSortDirection != SortOrder.None)
+ {
+ switch (TransactionSortDirection)
+ {
+ case SortOrder.Increasing:
+ Transactions = new ObservableCollection<TransactionViewModel>(_transactions.OrderBy(t => t.TransactionId));
+ break;
+
+ case SortOrder.Decreasing:
+ Transactions = new ObservableCollection<TransactionViewModel>(_transactions.OrderByDescending(t => t.TransactionId));
+ break;
+ }
+ }
+ else if (AmountSortDirection != SortOrder.None)
+ {
+ switch (AmountSortDirection)
+ {
+ case SortOrder.Increasing:
+ Transactions = new ObservableCollection<TransactionViewModel>(_transactions.OrderBy(t => t.AmountBtc));
+ break;
+
+ case SortOrder.Decreasing:
+ Transactions = new ObservableCollection<TransactionViewModel>(_transactions.OrderByDescending(t => t.AmountBtc));
+ break;
+ }
+ }
+ else if (DateSortDirection != SortOrder.None)
+ {
+ switch (DateSortDirection)
+ {
+ case SortOrder.Increasing:
+ Transactions = new ObservableCollection<TransactionViewModel>(_transactions.OrderBy(t => t.DateTime));
+ break;
+
+ case SortOrder.Decreasing:
+ Transactions = new ObservableCollection<TransactionViewModel>(_transactions.OrderByDescending(t => t.DateTime));
+ break;
+ }
+ }
+ }
}
}

[skip ci] Coinlist column header redesign