add filtering

This commit is contained in:
Alex
2025-08-08 02:00:48 -07:00
parent bc8da38329
commit db136ffbe7
3 changed files with 63 additions and 24 deletions
+29 -10
View File
@@ -1,8 +1,11 @@
using Microsoft.VisualBasic;
using System;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Threading.Tasks;
using Avalonia.Controls;
using MercuryConverter.Data;
using Avalonia;
namespace MercuryConverter.Views;
@@ -13,19 +16,35 @@ public partial class Selection : Panel
{
InitializeComponent();
ListingTable.SelectionMode = DataGridSelectionMode.Extended;
SourceFilter.ItemsSource = new string[]{
"",
Consts.NUM_SOURCE[1],
Consts.NUM_SOURCE[2],
Consts.NUM_SOURCE[3],
Consts.NUM_SOURCE[4],
Consts.NUM_SOURCE[5],
};
foreach (var (k, v) in Consts.NUM_SOURCE)
{
FilterSourceContainer.Children.Add(
new CheckBox
{
Name = $"FilterSourceCheckbox{k}",
Content = v,
}
);
}
foreach (var (k, v) in Consts.CATEGORY_INDEX)
{
if (k == -1)
continue;
FilterCategoryContainer.Children.Add(
new CheckBox
{
Name = $"FilterCategoryCheckbox{k}",
Content = v,
}
);
}
SongCollection.CollectionChanged += OnSongsChg;
DataContext = this;
// test data
// placeholder data
if (SongCollection.Count == 0)
{
SongCollection.Add(