修复bug和新增部分功能

This commit is contained in:
GG Z
2024-10-08 16:21:39 +08:00
parent 082b781808
commit b6647218be
44 changed files with 1709 additions and 1390 deletions

View File

@@ -1,14 +1,14 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using CommunityToolkit.Mvvm.ComponentModel;
using System.Runtime.CompilerServices;
namespace Wpf.Ui.Extend.Models;
public partial class TreeModel : ObservableObject, IComparable
public partial class TreeModel : INotifyPropertyChanged, IComparable
{
/// <summary>
/// 构造
@@ -16,22 +16,30 @@ public partial class TreeModel : ObservableObject, IComparable
public TreeModel()
{
Children = new ObservableCollection<TreeModel>();
isChecked = false;
Icon = "./Resources/File_16px.png";
IsChecked = false;
//Icon = "./Resources/File_16px.png";
//TitleIcon = FamilyPlugins.Properties.Resources.Folder_32px;
IsExpanded = false;
}
public event PropertyChangedEventHandler PropertyChanged;
protected void SetProperty<T>(ref T prop, T value, [CallerMemberName] string propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(prop, value) == false)
{
prop = value;
OnPropertyChanged(propertyName);
}
}
/// <summary>
/// 选中状态
/// </summary>
[ObservableProperty]
public virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
private bool? isChecked;
/// <summary>
/// 折叠状态
/// </summary>
[ObservableProperty]
private bool isExpanded;
/// <summary>
@@ -72,6 +80,22 @@ public partial class TreeModel : ObservableObject, IComparable
/// 父项
/// </summary>
public TreeModel Parent { get; set; }
/// <summary>
/// 选中状态
/// </summary>
public bool? IsChecked
{
get => isChecked;
set => SetProperty(ref isChecked, value);
}
/// <summary>
/// 折叠状态
/// </summary>
public bool IsExpanded
{
get => isExpanded;
set => SetProperty(ref isExpanded, value);
}
/// <summary>
/// 排序

View File

@@ -13,7 +13,6 @@
<AppendRuntimeIdentifierToOutputPath>False</AppendRuntimeIdentifierToOutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Runtime" Version="4.3.1" />
<PackageReference Include="WPF-UI" Version="4.0.0-rc.2" />