A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

30 lines
995 B

using Avalonia.Controls;
using ControlCatalog.ViewModels;
namespace ControlCatalog.Pages
{
public partial class ListBoxPage : UserControl
{
public ListBoxPage()
{
DataContext = new ListBoxPageViewModel();
InitializeComponent();
}
private void FilterItem(object? sender, FunctionItemFilter.FilterEventArgs e)
{
if (string.IsNullOrEmpty(SearchBox.Text))
{
e.Accept = true;
}
else
{
var item = (ItemModel)e.Item!;
e.Accept = item.IsFavorite || item.ID.ToString().Contains(SearchBox.Text);
}
}
private void SelectItemId(object? sender, ComparableSorter.ComparableSelectEventArgs e) => e.Comparable = ((ItemModel)e.Item!).ID;
private void SelectItemIsFavorite(object? sender, ComparableSorter.ComparableSelectEventArgs e) => e.Comparable = ((ItemModel)e.Item!).IsFavorite;
}
}