parent
9b6f8498d2
commit
9e13da5def
1 changed files with 21 additions and 0 deletions
|
|
@ -135,6 +135,15 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
|
||||
public IEnumerable<ListViewItem> Items => items;
|
||||
|
||||
public enum SortKey
|
||||
{
|
||||
Name,
|
||||
CreatedDate,
|
||||
ModifiedDate
|
||||
}
|
||||
|
||||
public SortKey ActiveSort { get; set; } = SortKey.Name;
|
||||
|
||||
/// <summary>
|
||||
/// Empties the list children and repopulates the list with the source container content
|
||||
/// </summary>
|
||||
|
|
@ -191,6 +200,18 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
&& this.ItemFilter(item)
|
||||
select item;
|
||||
|
||||
filteredResults = filteredResults.OrderBy(item =>
|
||||
{
|
||||
switch (ActiveSort)
|
||||
{
|
||||
case SortKey.Name:
|
||||
return item.Name;
|
||||
|
||||
default:
|
||||
return item.Name;
|
||||
}
|
||||
});
|
||||
|
||||
foreach (var item in filteredResults)
|
||||
{
|
||||
var listViewItem = new ListViewItem(item, this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue