Changed sort method.

This commit is contained in:
Michael Bucari-Tovo 2021-08-09 19:07:00 -06:00
parent d48bd5ad07
commit 5f8ca9a0b5
2 changed files with 7 additions and 3 deletions

View File

@ -91,7 +91,7 @@
this.gridEntryDataGridView.ReadOnly = true;
this.gridEntryDataGridView.RowHeadersVisible = false;
this.gridEntryDataGridView.RowTemplate.Height = 82;
this.gridEntryDataGridView.Size = new System.Drawing.Size(1503, 380);
this.gridEntryDataGridView.Size = new System.Drawing.Size(1505, 380);
this.gridEntryDataGridView.TabIndex = 0;
//
// dataGridViewImageButtonBoxColumn1
@ -216,7 +216,7 @@
this.Controls.Add(this.gridEntryDataGridView);
this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.Name = "ProductsGrid";
this.Size = new System.Drawing.Size(1503, 380);
this.Size = new System.Drawing.Size(1505, 380);
((System.ComponentModel.ISupportInitialize)(this.gridEntryBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gridEntryDataGridView)).EndInit();
this.ResumeLayout(false);

View File

@ -36,7 +36,11 @@ namespace LibationWinForms
Comparer.PropertyName = property.Name;
Comparer.Direction = direction;
itemsList.Sort(Comparer);
//Array.Sort and Liat<T>.Sort are unstable sorts. OrderBy is stable.
var sortedItems = itemsList.OrderBy((ge) => ge, Comparer).ToArray();
itemsList.Clear();
itemsList.AddRange(sortedItems);
propertyDescriptor = property;
listSortDirection = direction;