Files
Shrlalgo.RvKits/WPFluent.Gallery/ViewModels/Pages/BasicInputViewModel.cs
2025-05-05 17:04:06 +08:00

119 lines
2.8 KiB
C#

using System.Windows.Controls;
using WPFluent.Gallery.ControlsLookup;
using WPFluent.Gallery.Models;
using WPFluent.Gallery.Views.Pages;
namespace WPFluent.Gallery.ViewModels.Pages;
public class Grade
{
public string GradeLevel { get; set; }
public List<Student> Students { get; set; } = [];
}
public class Student
{
public int ID { get; set; }
public string Name { get; set; }
public string Class { get; set; }
}
public partial class BasicInputViewModel : ViewModel
{
public BasicInputViewModel()
{
GenerateTreeViewItem();
}
[ObservableProperty]
private ICollection<NavigationCard> navigationCards = new ObservableCollection<NavigationCard>(
ControlPages
.FromNamespace(typeof(BasicInputPage).Namespace!)
.Select(x => new NavigationCard()
{
Name = x.Name,
Icon = x.Icon,
Description = x.Description,
PageType = x.PageType,
})
);
[RelayCommand]
private void ButtonClick()
{
Toast.Information("I am information message");
Toast.Error("I am error message");
Toast.Success("I am success message");
Toast.Warning("I am warning message");
Toast.Show(owner: null!, "I am any message", new ToastConfig());
}
public ObservableCollection<Grade> Grades { get; set; } = [];
public ObservableCollection<Grade> SelectedItems { get; set; } = [];
public void GenerateTreeViewItem()
{
Grade item = new() { GradeLevel = "一年级" };
item.Students.Add(new() { Name = "学生11" });
item.Students.Add(new() { Name = "学生12" });
item.Students.Add(new() { Name = "学生13" });
Grade item1 = new() { GradeLevel = "二年级" };
item1.Students.Add(new() { Name = "学生21" });
item1.Students.Add(new() { Name = "学生22" });
Grades.Add(item);
Grades.Add(item1);
}
[ObservableProperty]
private ObservableCollection<string> animals =
[
"Cat",
"Dog",
"Bear",
"Lion",
"Mouse",
"Horse",
"Rat",
"Elephant",
"Kangaroo",
"Lizard",
"Snake",
"Frog",
"Fish",
"Butterfly",
"Human",
"Cow",
"Bumble Bee"
];
#region ComboBox
[ObservableProperty]
private ObservableCollection<string> _comboBoxFontFamilies =
[
"Arial",
"Comic Sans MS",
"Segoe UI",
"Times New Roman",
];
[ObservableProperty]
private ObservableCollection<int> _comboBoxFontSizes =
[
8,
9,
10,
11,
12,
14,
16,
18,
20,
24,
28,
36,
48,
72,
];
#endregion
}