fix: Maintain vs grid row sorting when selected exps change
This commit is contained in:
1 parent
4b2eda6a24
commit
6ffc3d4cad
2 files changed
+6
-1
No files matched your search
@@ -64,6 +64,7 @@
|
||||
|
||||
_dispose = Disposable.Create(
|
||||
ObservableAutoWrapper.connect(_expirations, rows, exp => new VolSurfaceRowContext(this, exp), row => row.Dispose()),
|
||||
sorted_visible_rows.bind(visible_rows),
|
||||
Disposable.Create(() => {
|
||||
this.model.on_candidate_grid_change -= _on_grid_updated;
|
||||
this.model.on_committed_grid_change -= _on_grid_updated;
|
||||
@@ -103,6 +104,7 @@
|
||||
|
||||
public ObservableCollection<VolSurfaceRowContext> rows { get; } = new();
|
||||
public ObservableCollection<VolSurfaceRowContext> visible_rows { get; } = new();
|
||||
public ObservableSortedCollection<VolSurfaceRowContext> sorted_visible_rows { get; } = new(_row_comparer);
|
||||
|
||||
public bool any_masters_selected =>
|
||||
selected_rows.select_display_exp().where_master().Any();
|
||||
@@ -121,6 +123,9 @@
|
||||
public ICommand graph_settings_command => _parent.vol_curve_vm.settings_command;
|
||||
public ICommand grid_settings_command => _parent.grid_settings_command;
|
||||
|
||||
static IComparer<VolSurfaceRowContext> _row_comparer =>
|
||||
Comparer<VolSurfaceDisplayGridExpiration>.Default.wrap<VolSurfaceDisplayGridExpiration, VolSurfaceRowContext>(r => r.expiration);
|
||||
|
||||
public void load_from(VolSurfaceMacroGridSettings grid_settings) {
|
||||
_hidden_columns = new HashSet<string>(grid_settings.hidden_cols());
|
||||
_columns_model.models.SetItems(grid_settings.column_settings.Select(c => c.to_column_model()));
|
||||
|
||||
@@ -231,7 +231,7 @@
|
||||
FrozenColumnCount="{Binding frozen_columns}"
|
||||
SuperHeaders="{Binding super_headers}"
|
||||
Columns="{Binding columns}"
|
||||
Rows="{Binding visible_rows}"
|
||||
Rows="{Binding sorted_visible_rows}"
|
||||
IsDragAdornerEnabled="False">
|
||||
<c:DIYGrid.Resources>
|
||||
<ContextMenu x:Key="context_menu" DataContext="{Binding context_menu}">
|
||||
|
||||
Reference in new issue
Block a user