2025-08-20 12:10:35 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
2025-08-12 23:08:54 +08:00
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using System.Windows;
|
2025-07-31 20:12:24 +08:00
|
|
|
|
using System.Windows.Controls;
|
2025-08-20 12:10:35 +08:00
|
|
|
|
using System.Windows.Controls.Primitives;
|
2025-08-12 23:08:54 +08:00
|
|
|
|
|
|
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
|
|
|
using CommunityToolkit.Mvvm.Input;
|
|
|
|
|
|
|
2025-08-20 12:10:13 +08:00
|
|
|
|
using NeoUI.Appearance;
|
|
|
|
|
|
using NeoUI.Controls;
|
2025-08-12 23:08:54 +08:00
|
|
|
|
|
2025-08-20 12:10:35 +08:00
|
|
|
|
namespace NeoUITest;
|
2025-07-31 20:12:24 +08:00
|
|
|
|
|
2025-08-12 23:08:54 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// MainWindow.xaml 的交互逻辑
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[ObservableObject]
|
|
|
|
|
|
public partial class MainWindow
|
2025-07-31 20:12:24 +08:00
|
|
|
|
{
|
2025-08-20 12:10:13 +08:00
|
|
|
|
public ObservableCollection<NodeViewModel> Nodes { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
// 用于绑定到MultiTreeView的SelectedItems
|
|
|
|
|
|
// 使用ObservableCollection可以自动通知UI集合变化
|
|
|
|
|
|
public ObservableCollection<object> SelectedNodes { get; set; }
|
2025-08-12 23:08:54 +08:00
|
|
|
|
public MainWindow()
|
2025-07-31 20:12:24 +08:00
|
|
|
|
{
|
2025-08-20 12:10:13 +08:00
|
|
|
|
// 创建示例数据
|
|
|
|
|
|
Nodes = new ObservableCollection<NodeViewModel>
|
|
|
|
|
|
{
|
|
|
|
|
|
new NodeViewModel
|
|
|
|
|
|
{
|
|
|
|
|
|
Name = "亚洲",
|
|
|
|
|
|
Children =
|
|
|
|
|
|
{
|
|
|
|
|
|
new NodeViewModel { Name = "中国" },
|
|
|
|
|
|
new NodeViewModel { Name = "日本" },
|
|
|
|
|
|
new NodeViewModel { Name = "韩国" }
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
new NodeViewModel
|
|
|
|
|
|
{
|
|
|
|
|
|
Name = "欧洲",
|
|
|
|
|
|
Children =
|
|
|
|
|
|
{
|
|
|
|
|
|
new NodeViewModel { Name = "德国" },
|
|
|
|
|
|
new NodeViewModel { Name = "法国" },
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
new NodeViewModel { Name = "北美洲" }
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 初始化选中的集合,并预选一个节点
|
|
|
|
|
|
SelectedNodes = new ObservableCollection<object>();
|
|
|
|
|
|
var chinaNode = Nodes[0].Children[0];
|
|
|
|
|
|
SelectedNodes.Add(chinaNode); // 默认选中"中国"
|
|
|
|
|
|
|
2025-08-12 23:08:54 +08:00
|
|
|
|
DataContext = this;
|
|
|
|
|
|
InitNode1Value();
|
2025-08-20 12:10:13 +08:00
|
|
|
|
|
|
|
|
|
|
InitializeComponent();
|
2025-08-12 23:08:54 +08:00
|
|
|
|
Items =
|
|
|
|
|
|
[
|
|
|
|
|
|
new RadioItem { Label = "Apple", Value = "Apple" },
|
|
|
|
|
|
new RadioItem { Label = "Pear", Value = "Pear" },
|
|
|
|
|
|
new RadioItem { Label = "Orange", Value = "Orange" }];
|
|
|
|
|
|
}
|
2025-08-20 12:10:13 +08:00
|
|
|
|
public ObservableCollection<Staff> StaffList { get; set; } = [];
|
2025-08-12 23:08:54 +08:00
|
|
|
|
private ObservableCollection<string> _allItems;
|
|
|
|
|
|
private IEnumerable<string> _pagedItems;
|
2025-07-31 20:12:24 +08:00
|
|
|
|
|
2025-08-12 23:08:54 +08:00
|
|
|
|
[ObservableProperty]
|
2025-08-20 12:10:13 +08:00
|
|
|
|
private Staff staff;
|
2025-08-12 23:08:54 +08:00
|
|
|
|
public void InitNode1Value()
|
|
|
|
|
|
{
|
|
|
|
|
|
Staff staff = new Staff() { Name = "Alice", Age = 30, Sex = "Male", Duty = "Manager", IsExpanded = true };
|
|
|
|
|
|
Staff staff2 = new Staff() { Name = "Alice1", Age = 21, Sex = "Male", Duty = "Normal", IsExpanded = true };
|
|
|
|
|
|
Staff staff3 = new Staff() { Name = "Alice11", Age = 21, Sex = "Male", Duty = "Normal" };
|
|
|
|
|
|
staff2.StaffList.Add(staff3);
|
|
|
|
|
|
staff3 = new Staff() { Name = "Alice22", Age = 21, Sex = "Female", Duty = "Normal" };
|
|
|
|
|
|
staff2.StaffList.Add(staff3);
|
|
|
|
|
|
staff.StaffList.Add(staff2);
|
|
|
|
|
|
staff2 = new Staff() { Name = "Alice2", Age = 22, Sex = "Female", Duty = "Normal" };
|
|
|
|
|
|
staff.StaffList.Add(staff2);
|
|
|
|
|
|
staff2 = new Staff() { Name = "Alice3", Age = 23, Sex = "Female", Duty = "Normal" };
|
|
|
|
|
|
staff.StaffList.Add(staff2);
|
|
|
|
|
|
StaffList.Add(staff);
|
|
|
|
|
|
|
|
|
|
|
|
staff = new Staff() { Name = "Bob", Age = 31, Sex = "Male", Duty = "CEO" };
|
|
|
|
|
|
staff2 = new Staff() { Name = "Bob1", Age = 24, Sex = "Female", Duty = "Normal" };
|
|
|
|
|
|
staff.StaffList.Add(staff2);
|
|
|
|
|
|
staff2 = new Staff() { Name = "Bob2", Age = 25, Sex = "Female", Duty = "Normal" };
|
|
|
|
|
|
staff.StaffList.Add(staff2);
|
|
|
|
|
|
staff2 = new Staff() { Name = "Bob3", Age = 26, Sex = "Male", Duty = "Normal" };
|
|
|
|
|
|
staff.StaffList.Add(staff2);
|
|
|
|
|
|
StaffList.Add(staff);
|
|
|
|
|
|
|
|
|
|
|
|
staff = new Staff() { Name = "Cyber", Age = 32, Sex = "Female", Duty = "Leader" };
|
|
|
|
|
|
staff2 = new Staff() { Name = "Cyber1", Age = 27, Sex = "Female", Duty = "Normal" };
|
|
|
|
|
|
staff.StaffList.Add(staff2);
|
|
|
|
|
|
staff2 = new Staff() { Name = "Cyber2", Age = 28, Sex = "Female", Duty = "Normal" };
|
|
|
|
|
|
staff.StaffList.Add(staff2);
|
|
|
|
|
|
StaffList.Add(staff);
|
|
|
|
|
|
}
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
private Area area;
|
2025-08-20 12:10:13 +08:00
|
|
|
|
|
|
|
|
|
|
public ObservableCollection<Area> SelectedObservableAreas { get; set; } = [];
|
2025-08-12 23:08:54 +08:00
|
|
|
|
[ObservableProperty]
|
2025-08-20 12:10:13 +08:00
|
|
|
|
public partial List<Area> SelectedListAreas { get; set; } = [];
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
private string password;
|
2025-08-12 23:08:54 +08:00
|
|
|
|
|
2025-08-20 12:10:13 +08:00
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
private string input;
|
2025-08-12 23:08:54 +08:00
|
|
|
|
[RelayCommand]
|
2025-08-20 12:10:13 +08:00
|
|
|
|
private void AddArea()
|
2025-08-12 23:08:54 +08:00
|
|
|
|
{
|
2025-08-20 12:10:13 +08:00
|
|
|
|
|
2025-08-12 23:08:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
public Area[] Areas
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
} =
|
|
|
|
|
|
{
|
|
|
|
|
|
new Area(0, "北海道"),
|
|
|
|
|
|
new Area(1, "青森県"),
|
|
|
|
|
|
new Area(2, "岩手県"),
|
|
|
|
|
|
new Area(3, "宮城県"),
|
|
|
|
|
|
new Area(4, "秋田県"),
|
|
|
|
|
|
new Area(5, "山形県"),
|
|
|
|
|
|
new Area(6, "福島県"),
|
|
|
|
|
|
new Area(7, "茨城県"),
|
|
|
|
|
|
new Area(8, "栃木県"),
|
|
|
|
|
|
new Area(9, "群馬県"),
|
|
|
|
|
|
new Area(10, "埼玉県"),
|
|
|
|
|
|
new Area(11, "千葉県"),
|
|
|
|
|
|
new Area(12, "東京都"),
|
|
|
|
|
|
new Area(13, "神奈川県"),
|
|
|
|
|
|
new Area(14, "新潟県"),
|
|
|
|
|
|
new Area(15, "富山県"),
|
|
|
|
|
|
new Area(16, "石川県"),
|
|
|
|
|
|
new Area(17, "福井県"),
|
|
|
|
|
|
new Area(18, "山梨県"),
|
|
|
|
|
|
new Area(19, "長野県"),
|
|
|
|
|
|
new Area(20, "岐阜県"),
|
|
|
|
|
|
new Area(21, "静岡県"),
|
|
|
|
|
|
new Area(22, "愛知県"),
|
|
|
|
|
|
new Area(23, "三重県"),
|
|
|
|
|
|
new Area(24, "滋賀県"),
|
|
|
|
|
|
new Area(25, "京都府"),
|
|
|
|
|
|
new Area(26, "大阪府"),
|
|
|
|
|
|
new Area(27, "兵庫県"),
|
|
|
|
|
|
new Area(28, "奈良県"),
|
|
|
|
|
|
new Area(29, "和歌山県"),
|
|
|
|
|
|
new Area(30, "鳥取県"),
|
|
|
|
|
|
new Area(31, "島根県"),
|
|
|
|
|
|
new Area(32, "岡山県"),
|
|
|
|
|
|
new Area(33, "広島県"),
|
|
|
|
|
|
new Area(34, "山口県"),
|
|
|
|
|
|
new Area(35, "徳島県"),
|
|
|
|
|
|
new Area(36, "香川県"),
|
|
|
|
|
|
new Area(37, "愛媛県"),
|
|
|
|
|
|
new Area(38, "高知県"),
|
|
|
|
|
|
new Area(39, "福岡県"),
|
|
|
|
|
|
new Area(40, "佐賀県"),
|
|
|
|
|
|
new Area(41, "長崎県"),
|
|
|
|
|
|
new Area(42, "熊本県"),
|
|
|
|
|
|
new Area(43, "大分県"),
|
|
|
|
|
|
new Area(44, "宮崎県"),
|
|
|
|
|
|
new Area(45, "鹿児島県"),
|
|
|
|
|
|
new Area(46, "沖縄県")
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
public IEnumerable<RadioItem> Items { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public struct RadioItem
|
|
|
|
|
|
{
|
|
|
|
|
|
public string Label;
|
|
|
|
|
|
|
|
|
|
|
|
public string Value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!_loaded)
|
|
|
|
|
|
return;
|
|
|
|
|
|
TextMessage.Text = "选项变化" + e.OriginalSource;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private bool _loaded = false;
|
|
|
|
|
|
private void Window_Loaded(object sender, RoutedEventArgs e) { _loaded = true; }
|
|
|
|
|
|
|
|
|
|
|
|
private void Switch_OnClick(object sender, RoutedEventArgs e) { ThemeManager.SwitchThemeMode(); }
|
|
|
|
|
|
|
|
|
|
|
|
private void Test_OnClick(object sender, RoutedEventArgs e) { new ControlTestWindow().Show(); }
|
|
|
|
|
|
|
|
|
|
|
|
private void Breadcrumb_Navigate(object sender, RoutedPropertyChangedEventArgs<string> e)
|
|
|
|
|
|
{ MessageBox.Show(e.NewValue); }
|
|
|
|
|
|
|
|
|
|
|
|
private void LeftTopButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
NotificationManager.Show(
|
|
|
|
|
|
"发生错误",
|
|
|
|
|
|
"无法连接到服务器,请检查您的网络连接。",
|
|
|
|
|
|
NotificationType.Error,
|
|
|
|
|
|
NotificationPlacement.TopLeft,
|
|
|
|
|
|
durationSeconds: 5); // 自定义持续时间
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void RightTopButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
NotificationManager.Show("操作成功", "您的设置已保存,并已成功应用到系统中。", NotificationType.Success);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void LeftBottomButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
NotificationManager.Show(
|
|
|
|
|
|
"警告",
|
|
|
|
|
|
"您的磁盘空间即将用尽,请及时清理文件。",
|
|
|
|
|
|
NotificationType.Warning,
|
|
|
|
|
|
NotificationPlacement.BottomLeft);
|
2025-08-20 12:10:13 +08:00
|
|
|
|
|
2025-08-12 23:08:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void RightBottomButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
NotificationManager.Show(
|
|
|
|
|
|
"系统提示",
|
|
|
|
|
|
"这是一条普通的信息提示,用于通知用户。",
|
|
|
|
|
|
NotificationType.Info,
|
|
|
|
|
|
NotificationPlacement.BottomRight);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Info_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
Toast.Screen.ShowInfo("这是一条桌面通知,显示在屏幕右下角。");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Success_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
Toast.For(this).ShowSuccess("操作成功!已在当前窗口内显示。");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Warning_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
Toast.Screen.ShowWarning("您的订阅即将过期,请及时续订。");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Error_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
Toast.For(this).ShowError("加载失败,请检查您的网络连接。");
|
|
|
|
|
|
}
|
2025-07-31 20:12:24 +08:00
|
|
|
|
|
2025-08-12 23:08:54 +08:00
|
|
|
|
private void ShowBasicModal_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool? result = Modal.Confirm(this, "Basic Dialog", "This is a basic modal dialog.");
|
|
|
|
|
|
if (result == true)
|
2025-07-31 20:12:24 +08:00
|
|
|
|
{
|
2025-08-12 23:08:54 +08:00
|
|
|
|
// 处理OK逻辑
|
|
|
|
|
|
MessageBox.Show("User clicked OK!");
|
2025-07-31 20:12:24 +08:00
|
|
|
|
}
|
2025-08-12 23:08:54 +08:00
|
|
|
|
}
|
2025-07-31 20:12:24 +08:00
|
|
|
|
|
2025-08-12 23:08:54 +08:00
|
|
|
|
// 异步关闭用法
|
|
|
|
|
|
private async void ShowAsyncModal_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool? result = Modal.Confirm(this,
|
|
|
|
|
|
"Async Dialog",
|
|
|
|
|
|
"This dialog will close after a 2-second task.",
|
2025-08-20 12:10:13 +08:00
|
|
|
|
async () =>
|
|
|
|
|
|
{
|
2025-08-12 23:08:54 +08:00
|
|
|
|
// 模拟一个耗时操作
|
|
|
|
|
|
await Task.Delay(2000);
|
|
|
|
|
|
// 返回true表示操作成功,可以关闭对话框
|
|
|
|
|
|
// 返回false则对话框会保持打开状态
|
|
|
|
|
|
return true;
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (result == true)
|
2025-07-31 20:12:24 +08:00
|
|
|
|
{
|
2025-08-12 23:08:54 +08:00
|
|
|
|
MessageBox.Show("Async task completed and user clicked OK!");
|
2025-07-31 20:12:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-08-12 23:08:54 +08:00
|
|
|
|
|
|
|
|
|
|
// 静态信息框
|
|
|
|
|
|
private void ShowInfoModal_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
Modal.Info(this, "Information", "This is an information dialog.");
|
|
|
|
|
|
}
|
2025-08-20 12:10:13 +08:00
|
|
|
|
|
|
|
|
|
|
private void Icon_OnClick(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
IconsWindow iconsWindow = new IconsWindow
|
|
|
|
|
|
{
|
|
|
|
|
|
Owner = this,
|
|
|
|
|
|
WindowStartupLocation = WindowStartupLocation.CenterOwner
|
|
|
|
|
|
};
|
|
|
|
|
|
iconsWindow.ShowDialog();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-20 12:10:35 +08:00
|
|
|
|
// 重入保护标志
|
|
|
|
|
|
private bool _themeAnimating;
|
2025-08-20 12:10:13 +08:00
|
|
|
|
|
2025-08-20 12:10:35 +08:00
|
|
|
|
// ToggleButton.Checked / Unchecked 都指向这个
|
|
|
|
|
|
private async void ThemeToggle_OnCheckedChanged(object sender, RoutedEventArgs e)
|
2025-08-20 12:10:13 +08:00
|
|
|
|
{
|
2025-08-20 12:10:35 +08:00
|
|
|
|
if (_themeAnimating) return; // 丢弃重入,也可以排队
|
|
|
|
|
|
if (sender is not ToggleButton tb) return;
|
|
|
|
|
|
|
|
|
|
|
|
var targetMode = tb.IsChecked == true ? ThemeMode.Dark : ThemeMode.Light;
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
_themeAnimating = true;
|
|
|
|
|
|
// 动画时长可调;若需要与调色板同步也可传 palette
|
|
|
|
|
|
await ThemeManager.ApplyThemeAsync(targetMode, null, animate: true, animationDurationMs: 300);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
System.Diagnostics.Debug.WriteLine("[ThemeToggle] " + ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
finally
|
|
|
|
|
|
{
|
|
|
|
|
|
_themeAnimating = false;
|
|
|
|
|
|
}
|
2025-08-20 12:10:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void ColorPalette_OnClick(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
var palette = new ColorPaletteWindow
|
|
|
|
|
|
{
|
|
|
|
|
|
Owner = this,
|
|
|
|
|
|
WindowStartupLocation = WindowStartupLocation.CenterOwner
|
|
|
|
|
|
};
|
|
|
|
|
|
palette.ShowDialog();
|
|
|
|
|
|
}
|
2025-08-20 12:10:35 +08:00
|
|
|
|
|
|
|
|
|
|
private void PrimaryColorSelectComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (sender is ComboBox box)
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (box.SelectedIndex)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
ThemeManager.ApplyThemePalette(ThemePalette.Blue);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
ThemeManager.ApplyThemePalette(ThemePalette.Green);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
ThemeManager.ApplyThemePalette(ThemePalette.Purple);
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-08-20 12:10:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
public class ViewModelBase : INotifyPropertyChanged
|
|
|
|
|
|
{
|
|
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
|
|
protected void OnPropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string propertyName = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
|
|
|
|
}
|
2025-08-12 23:08:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-20 12:10:13 +08:00
|
|
|
|
// 树节点的数据模型
|
|
|
|
|
|
public class NodeViewModel : ViewModelBase
|
|
|
|
|
|
{
|
|
|
|
|
|
private string _name;
|
|
|
|
|
|
public string Name
|
|
|
|
|
|
{
|
|
|
|
|
|
get => _name;
|
|
|
|
|
|
set { _name = value; OnPropertyChanged(); }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 注意:这里不需要IsChecked属性,因为它由MultiTreeViewItem管理
|
|
|
|
|
|
// 如果需要更复杂的逻辑(例如持久化选中状态),可以在这里添加
|
|
|
|
|
|
|
|
|
|
|
|
public ObservableCollection<NodeViewModel> Children { get; set; } = new ObservableCollection<NodeViewModel>();
|
|
|
|
|
|
}
|
2025-08-12 23:08:54 +08:00
|
|
|
|
public record Area(int Id, string Name)
|
|
|
|
|
|
{
|
|
|
|
|
|
public int Id { get; } = Id;
|
|
|
|
|
|
|
|
|
|
|
|
public string Name { get; } = Name;
|
|
|
|
|
|
|
|
|
|
|
|
public override string ToString() => Name;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public partial class Staff : ObservableObject
|
|
|
|
|
|
{
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
private string name = null!;
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
private int age;
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
private string sex = null!;
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
private string duty = null!;
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
private bool isChecked = true;
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
private bool isSelected = false;
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
private bool isExpanded = false;
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
private ObservableCollection<Staff> staffList = [];
|
2025-07-31 20:12:24 +08:00
|
|
|
|
}
|