diff --git a/Semi.Avalonia.sln b/Semi.Avalonia.sln
index 41c8732..e41901a 100644
--- a/Semi.Avalonia.sln
+++ b/Semi.Avalonia.sln
@@ -39,8 +39,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Semi.Avalonia.Demo.Drm", "d
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Semi.Avalonia.TreeDataGrid", "src\Semi.Avalonia.TreeDataGrid\Semi.Avalonia.TreeDataGrid.csproj", "{398D2998-0835-41F5-99A3-608CAB8051E2}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Semi.Avalonia.TreeDataGrid.Demo", "demo\Semi.Avalonia.TreeDataGrid.Demo\Semi.Avalonia.TreeDataGrid.Demo.csproj", "{6178B545-4BB6-458C-A27C-EE11F3885D38}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -84,10 +82,6 @@ Global
{398D2998-0835-41F5-99A3-608CAB8051E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{398D2998-0835-41F5-99A3-608CAB8051E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{398D2998-0835-41F5-99A3-608CAB8051E2}.Release|Any CPU.Build.0 = Release|Any CPU
- {6178B545-4BB6-458C-A27C-EE11F3885D38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6178B545-4BB6-458C-A27C-EE11F3885D38}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6178B545-4BB6-458C-A27C-EE11F3885D38}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6178B545-4BB6-458C-A27C-EE11F3885D38}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -98,7 +92,6 @@ Global
{D789AEDB-EBDF-4450-8E8E-B4A03FB257B0} = {43091528-9509-43CB-A003-9C5C11E96DD6}
{0C81FC1C-5D2D-478A-9876-923A0C85EC2F} = {43091528-9509-43CB-A003-9C5C11E96DD6}
{86D93406-412A-4429-93B2-92AAD0407784} = {43091528-9509-43CB-A003-9C5C11E96DD6}
- {6178B545-4BB6-458C-A27C-EE11F3885D38} = {43091528-9509-43CB-A003-9C5C11E96DD6}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7CA41ED3-2CED-40CC-AA21-28C3B42B1E86}
diff --git a/demo/Semi.Avalonia.Demo/App.axaml b/demo/Semi.Avalonia.Demo/App.axaml
index 6af3dda..3f18920 100644
--- a/demo/Semi.Avalonia.Demo/App.axaml
+++ b/demo/Semi.Avalonia.Demo/App.axaml
@@ -13,6 +13,7 @@
+
diff --git a/demo/Semi.Avalonia.TreeDataGrid.Demo/Converters/FileIconConverter.cs b/demo/Semi.Avalonia.Demo/Converters/FileIconConverter.cs
similarity index 93%
rename from demo/Semi.Avalonia.TreeDataGrid.Demo/Converters/FileIconConverter.cs
rename to demo/Semi.Avalonia.Demo/Converters/FileIconConverter.cs
index 88acb9d..bdb170d 100644
--- a/demo/Semi.Avalonia.TreeDataGrid.Demo/Converters/FileIconConverter.cs
+++ b/demo/Semi.Avalonia.Demo/Converters/FileIconConverter.cs
@@ -5,7 +5,7 @@ using Avalonia;
using Avalonia.Data.Converters;
using Avalonia.Metadata;
-namespace Semi.Avalonia.TreeDataGrid.Demo.Converters;
+namespace Semi.Avalonia.Demo.Converters;
public class FileIconConverter : IMultiValueConverter
{
diff --git a/demo/Semi.Avalonia.Demo/Pages/TreeDataGridDemo.axaml b/demo/Semi.Avalonia.Demo/Pages/TreeDataGridDemo.axaml
new file mode 100644
index 0000000..d6453f4
--- /dev/null
+++ b/demo/Semi.Avalonia.Demo/Pages/TreeDataGridDemo.axaml
@@ -0,0 +1,127 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/demo/Semi.Avalonia.Demo/Pages/TreeDataGridDemo.axaml.cs b/demo/Semi.Avalonia.Demo/Pages/TreeDataGridDemo.axaml.cs
new file mode 100644
index 0000000..9da4a82
--- /dev/null
+++ b/demo/Semi.Avalonia.Demo/Pages/TreeDataGridDemo.axaml.cs
@@ -0,0 +1,23 @@
+using Avalonia.Controls;
+using Avalonia.Input;
+using Semi.Avalonia.Demo.ViewModels;
+
+namespace Semi.Avalonia.Demo.Pages;
+
+public partial class TreeDataGridDemo : UserControl
+{
+ public TreeDataGridDemo()
+ {
+ InitializeComponent();
+ this.DataContext = new TreeDataGridDemoViewModel();
+ }
+
+ private void SelectedPath_KeyDown(object? sender, KeyEventArgs e)
+ {
+ if (e.Key == Key.Enter)
+ {
+ var vm = DataContext as TreeDataGridDemoViewModel;
+ vm.FilesContext.SelectedPath = (sender as TextBox)!.Text;
+ }
+ }
+}
\ No newline at end of file
diff --git a/demo/Semi.Avalonia.Demo/Semi.Avalonia.Demo.csproj b/demo/Semi.Avalonia.Demo/Semi.Avalonia.Demo.csproj
index 6bea869..38a0043 100644
--- a/demo/Semi.Avalonia.Demo/Semi.Avalonia.Demo.csproj
+++ b/demo/Semi.Avalonia.Demo/Semi.Avalonia.Demo.csproj
@@ -1,6 +1,6 @@
- netstandard2.0
+ net8.0
enable
latest
@@ -25,5 +25,6 @@
+
diff --git a/demo/Semi.Avalonia.Demo/ViewModels/DataGridDemoViewModel.cs b/demo/Semi.Avalonia.Demo/ViewModels/DataGridDemoViewModel.cs
index e1ec6a7..eae835b 100644
--- a/demo/Semi.Avalonia.Demo/ViewModels/DataGridDemoViewModel.cs
+++ b/demo/Semi.Avalonia.Demo/ViewModels/DataGridDemoViewModel.cs
@@ -59,6 +59,25 @@ public class Song
Url = $"https://music.163.com/song?id={netEaseId}";
}
+ public static List Albums =>
+ [
+ "A.S.I.A",
+ "饕餮人间",
+ "七步咙咚呛",
+ "大惊小怪",
+ "The ONE",
+ "以梦为马 (壮志骄阳版)",
+ "emo了",
+ "一眼万年",
+ "冲刺吧",
+ "爱的赏味期限",
+ "COSMIC ANTHEM / 手紙",
+ "世界晚安",
+ "明年也要好好长大",
+ "320万年前",
+ "W.O.R.L.D."
+ ];
+
public static List Songs =>
[
new("好肚有肚(feat.李玲玉)", "熊猫堂ProducePandas", 2, 50, "A.S.I.A", 730, 1487039339),
diff --git a/demo/Semi.Avalonia.TreeDataGrid.Demo/ViewModels/FilesPageViewModel.cs b/demo/Semi.Avalonia.Demo/ViewModels/TreeDataGridDemo/FilesPageViewModel.cs
similarity index 78%
rename from demo/Semi.Avalonia.TreeDataGrid.Demo/ViewModels/FilesPageViewModel.cs
rename to demo/Semi.Avalonia.Demo/ViewModels/TreeDataGridDemo/FilesPageViewModel.cs
index 3349363..c3b6ee7 100644
--- a/demo/Semi.Avalonia.TreeDataGrid.Demo/ViewModels/FilesPageViewModel.cs
+++ b/demo/Semi.Avalonia.Demo/ViewModels/TreeDataGridDemo/FilesPageViewModel.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
+using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
@@ -11,43 +12,40 @@ using Avalonia.Controls.Selection;
using Avalonia.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
-namespace Semi.Avalonia.TreeDataGrid.Demo.ViewModels;
+namespace Semi.Avalonia.Demo.ViewModels;
-public class FilesPageViewModel: ObservableObject
+public partial class FilesPageViewModel : ObservableObject
{
public IList Drives { get; }
- private string _selectedDrive;
- private string? _selectedPath;
- private FileNodeViewModel? _root;
- public string SelectedDrive
+ public HierarchicalTreeDataGridSource Source { get; }
+ [ObservableProperty] private string _selectedDrive;
+ [ObservableProperty] private string? _selectedPath;
+ [ObservableProperty] private FileNodeViewModel? _root;
+
+ partial void OnSelectedDriveChanged(string value)
{
- get => _selectedDrive;
- set
+ Root = new FileNodeViewModel(value, true, true);
+ if (Source is not null)
{
- SetProperty(ref _selectedDrive, value);
- _root = new FileNodeViewModel(_selectedDrive, isDirectory: true, isRoot: true);
- Source.Items = new[] { _root };
+ Source.Items = [Root];
}
}
- public string? SelectedPath
+ partial void OnSelectedPathChanged(string? value)
{
- get => _selectedPath;
- set => SetSelectedPath(value);
+ SetSelectedPath(value);
}
-
- public HierarchicalTreeDataGridSource Source { get; }
public FilesPageViewModel()
{
- Drives= DriveInfo.GetDrives().Select(x => x.Name).ToList();
+ Drives = DriveInfo.GetDrives().Select(x => x.Name).ToList();
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
- _selectedDrive = "C:\\";
+ SelectedDrive = @"C:\";
}
else
{
- _selectedDrive = Drives.FirstOrDefault() ?? "/";
+ SelectedDrive = Drives.FirstOrDefault() ?? "/";
}
Source = new HierarchicalTreeDataGridSource(Array.Empty())
@@ -58,7 +56,7 @@ public class FilesPageViewModel: ObservableObject
null,
x => x.IsChecked,
(o, v) => o.IsChecked = v,
- options: new()
+ options: new CheckBoxColumnOptions
{
CanUserResizeColumn = false,
}),
@@ -68,20 +66,20 @@ public class FilesPageViewModel: ObservableObject
"FileNameCell",
"FileNameEditCell",
new GridLength(1, GridUnitType.Star),
- new()
+ new TemplateColumnOptions
{
- CompareAscending = FileNodeViewModel.SortAscending(x => x.Name),
- CompareDescending = FileNodeViewModel.SortDescending(x => x.Name),
+ CompareAscending = FileNodeViewModel.SortAscending(vm => vm.Name),
+ CompareDescending = FileNodeViewModel.SortDescending(vm => vm.Name),
IsTextSearchEnabled = true,
- TextSearchValueSelector = x => x.Name
+ TextSearchValueSelector = vm => vm.Name
}),
- x => x.Children,
- x => x.HasChildren,
- x => x.IsExpanded),
+ vm => vm.Children,
+ vm => vm.HasChildren,
+ vm => vm.IsExpanded),
new TextColumn(
"Size",
- x => x.Size,
- options: new()
+ vm => vm.Size,
+ options: new TextColumnOptions
{
CompareAscending = FileNodeViewModel.SortAscending(x => x.Size),
CompareDescending = FileNodeViewModel.SortDescending(x => x.Size),
@@ -89,7 +87,7 @@ public class FilesPageViewModel: ObservableObject
new TextColumn(
"Modified",
x => x.Modified,
- options: new()
+ options: new TextColumnOptions
{
CompareAscending = FileNodeViewModel.SortAscending(x => x.Modified),
CompareDescending = FileNodeViewModel.SortDescending(x => x.Modified),
@@ -99,18 +97,18 @@ public class FilesPageViewModel: ObservableObject
Source.RowSelection!.SingleSelect = false;
Source.RowSelection.SelectionChanged += SelectionChanged;
}
-
+
private void SelectionChanged(object? sender, TreeSelectionModelSelectionChangedEventArgs e)
{
var selectedPath = Source.RowSelection?.SelectedItem?.Path;
this.SetProperty(ref _selectedPath, selectedPath, nameof(SelectedPath));
foreach (var i in e.DeselectedItems)
- System.Diagnostics.Trace.WriteLine($"Deselected '{i?.Path}'");
+ Trace.WriteLine($"Deselected '{i?.Path}'");
foreach (var i in e.SelectedItems)
- System.Diagnostics.Trace.WriteLine($"Selected '{i?.Path}'");
+ Trace.WriteLine($"Selected '{i?.Path}'");
}
-
+
private void SetSelectedPath(string? value)
{
if (string.IsNullOrEmpty(value))
@@ -164,27 +162,28 @@ public class FilesPageViewModel: ObservableObject
}
}
+ Source.Items = [Root];
Source.RowSelection!.SelectedIndex = index;
}
}
-public class FileNodeViewModel: ObservableObject, IEditableObject
+public partial class FileNodeViewModel : ObservableObject, IEditableObject
{
- private string _path;
- private string _name;
+ [ObservableProperty] private string _path;
+ [ObservableProperty] private string _name;
private string? _undoName;
- private long? _size;
- private DateTimeOffset? _modified;
+ [ObservableProperty] private long? _size;
+ [ObservableProperty] private DateTimeOffset? _modified;
private FileSystemWatcher? _watcher;
private ObservableCollection? _children;
- private bool _hasChildren = true;
- private bool _isExpanded;
+ [ObservableProperty] private bool _hasChildren = true;
+ [ObservableProperty] private bool _isExpanded;
- public FileNodeViewModel( string path, bool isDirectory, bool isRoot = false)
+ public FileNodeViewModel(string path, bool isDirectory, bool isRoot = false)
{
- _path = path;
- _name = isRoot ? path : System.IO.Path.GetFileName(Path);
- _isExpanded = isRoot;
+ Path = path;
+ Name = isRoot ? path : System.IO.Path.GetFileName(Path);
+ IsExpanded = isRoot;
IsDirectory = isDirectory;
HasChildren = isDirectory;
@@ -196,42 +195,6 @@ public class FileNodeViewModel: ObservableObject, IEditableObject
}
}
- public string Path
- {
- get => _path;
- private set => SetProperty(ref _path, value);
- }
-
- public string Name
- {
- get => _name;
- private set => SetProperty(ref _name, value);
- }
-
- public long? Size
- {
- get => _size;
- private set => SetProperty(ref _size, value);
- }
-
- public DateTimeOffset? Modified
- {
- get => _modified;
- private set => SetProperty(ref _modified, value);
- }
-
- public bool HasChildren
- {
- get => _hasChildren;
- private set => SetProperty(ref _hasChildren, value);
- }
-
- public bool IsExpanded
- {
- get => _isExpanded;
- set => SetProperty(ref _isExpanded, value);
- }
-
public bool IsChecked { get; set; }
public bool IsDirectory { get; }
public IReadOnlyList Children => _children ??= LoadChildren();
@@ -332,6 +295,7 @@ public class FileNodeViewModel: ObservableObject, IEditableObject
child.Size = info.Length;
child.Modified = info.LastWriteTimeUtc;
}
+
break;
}
}
@@ -359,7 +323,7 @@ public class FileNodeViewModel: ObservableObject, IEditableObject
if (_children[i].Path == e.FullPath)
{
_children.RemoveAt(i);
- System.Diagnostics.Debug.WriteLine($"Removed {e.FullPath}");
+ Debug.WriteLine($"Removed {e.FullPath}");
break;
}
}
@@ -394,6 +358,7 @@ internal static class ListExtensions
return i;
i++;
}
+
return -1;
}
}
\ No newline at end of file
diff --git a/demo/Semi.Avalonia.Demo/ViewModels/TreeDataGridDemo/SongsPageViewModel.cs b/demo/Semi.Avalonia.Demo/ViewModels/TreeDataGridDemo/SongsPageViewModel.cs
new file mode 100644
index 0000000..5c0ba5e
--- /dev/null
+++ b/demo/Semi.Avalonia.Demo/ViewModels/TreeDataGridDemo/SongsPageViewModel.cs
@@ -0,0 +1,54 @@
+using System.Collections.ObjectModel;
+using System.Linq;
+using Avalonia.Controls;
+using Avalonia.Controls.Models.TreeDataGrid;
+using CommunityToolkit.Mvvm.ComponentModel;
+
+namespace Semi.Avalonia.Demo.ViewModels;
+
+public class SongsPageViewModel : ObservableObject
+{
+ public FlatTreeDataGridSource Songs { get; }
+
+ public SongsPageViewModel()
+ {
+ var songs = new ObservableCollection(Song.Songs.Select(a => new SongViewModel()
+ {
+ Title = a.Title,
+ Artist = a.Artist,
+ Album = a.Album,
+ CountOfComment = a.CountOfComment,
+ IsSelected = false
+ }));
+
+ Songs = new FlatTreeDataGridSource(songs)
+ {
+ Columns =
+ {
+ new CheckBoxColumn(
+ "IsSelected",
+ a => a.IsSelected,
+ (model, b) => { model.IsSelected = b; },
+ new GridLength(108, GridUnitType.Pixel)),
+ new TextColumn(
+ "Title",
+ a => a.Title,
+ (o, a) => o.Title = a,
+ new GridLength(6, GridUnitType.Star)),
+ new TextColumn("Artist",
+ a => a.Artist,
+ (o, a) => o.Artist = a,
+ new GridLength(6, GridUnitType.Star)),
+ new TemplateColumn("Album",
+ "AlbumCell",
+ "AlbumEditCell",
+ new GridLength(6, GridUnitType.Star)),
+ new TemplateColumn(
+ "Comments",
+ "CommentsCell",
+ "CommentsEditCell",
+ new GridLength(6, GridUnitType.Star)),
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/demo/Semi.Avalonia.TreeDataGrid.Demo/ViewModels/MainViewModel.cs b/demo/Semi.Avalonia.Demo/ViewModels/TreeDataGridDemo/TreeDataGridDemoViewModel.cs
similarity index 63%
rename from demo/Semi.Avalonia.TreeDataGrid.Demo/ViewModels/MainViewModel.cs
rename to demo/Semi.Avalonia.Demo/ViewModels/TreeDataGridDemo/TreeDataGridDemoViewModel.cs
index 066bcb4..791d14b 100644
--- a/demo/Semi.Avalonia.TreeDataGrid.Demo/ViewModels/MainViewModel.cs
+++ b/demo/Semi.Avalonia.Demo/ViewModels/TreeDataGridDemo/TreeDataGridDemoViewModel.cs
@@ -1,8 +1,8 @@
using CommunityToolkit.Mvvm.ComponentModel;
-namespace Semi.Avalonia.TreeDataGrid.Demo.ViewModels;
+namespace Semi.Avalonia.Demo.ViewModels;
-public class MainViewModel: ObservableObject
+public class TreeDataGridDemoViewModel: ObservableObject
{
public SongsPageViewModel SongsContext { get; } = new();
public FilesPageViewModel FilesContext { get; } = new();
diff --git a/demo/Semi.Avalonia.Demo/Views/MainView.axaml b/demo/Semi.Avalonia.Demo/Views/MainView.axaml
index 2f79f72..bc1422b 100644
--- a/demo/Semi.Avalonia.Demo/Views/MainView.axaml
+++ b/demo/Semi.Avalonia.Demo/Views/MainView.axaml
@@ -135,6 +135,9 @@
+
+
+
diff --git a/demo/Semi.Avalonia.TreeDataGrid.Demo/App.axaml b/demo/Semi.Avalonia.TreeDataGrid.Demo/App.axaml
deleted file mode 100644
index 35166a6..0000000
--- a/demo/Semi.Avalonia.TreeDataGrid.Demo/App.axaml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/Semi.Avalonia.TreeDataGrid.Demo/App.axaml.cs b/demo/Semi.Avalonia.TreeDataGrid.Demo/App.axaml.cs
deleted file mode 100644
index c4d36b3..0000000
--- a/demo/Semi.Avalonia.TreeDataGrid.Demo/App.axaml.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using Avalonia;
-using Avalonia.Controls.ApplicationLifetimes;
-using Avalonia.Markup.Xaml;
-
-namespace Semi.Avalonia.TreeDataGrid.Demo;
-
-public partial class App : Application
-{
- public override void Initialize()
- {
- AvaloniaXamlLoader.Load(this);
- }
-
- public override void OnFrameworkInitializationCompleted()
- {
- if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
- {
- desktop.MainWindow = new MainWindow();
- }
-
- base.OnFrameworkInitializationCompleted();
- }
-}
\ No newline at end of file
diff --git a/demo/Semi.Avalonia.TreeDataGrid.Demo/MainWindow.axaml b/demo/Semi.Avalonia.TreeDataGrid.Demo/MainWindow.axaml
deleted file mode 100644
index 076f2bd..0000000
--- a/demo/Semi.Avalonia.TreeDataGrid.Demo/MainWindow.axaml
+++ /dev/null
@@ -1,136 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/Semi.Avalonia.TreeDataGrid.Demo/MainWindow.axaml.cs b/demo/Semi.Avalonia.TreeDataGrid.Demo/MainWindow.axaml.cs
deleted file mode 100644
index 002823f..0000000
--- a/demo/Semi.Avalonia.TreeDataGrid.Demo/MainWindow.axaml.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Input;
-using Avalonia.Interactivity;
-using Avalonia.Styling;
-using Semi.Avalonia.TreeDataGrid.Demo.ViewModels;
-
-namespace Semi.Avalonia.TreeDataGrid.Demo;
-
-public partial class MainWindow : Window
-{
- public MainWindow()
- {
- InitializeComponent();
- this.DataContext = new MainViewModel();
- }
-
- private void Button_OnClick(object? sender, RoutedEventArgs e)
- {
- var app = Application.Current;
- if (app is not null)
- {
- var theme = app.ActualThemeVariant;
- app.RequestedThemeVariant = theme == ThemeVariant.Dark ? ThemeVariant.Light : ThemeVariant.Dark;
- }
- }
-
- private void SelectedPath_KeyDown(object? sender, KeyEventArgs e)
- {
- if (e.Key == Key.Enter)
- {
- var vm = (MainViewModel)DataContext!;
- vm.FilesContext.SelectedPath = ((TextBox)sender!).Text;
- }
- }
-}
\ No newline at end of file
diff --git a/demo/Semi.Avalonia.TreeDataGrid.Demo/Program.cs b/demo/Semi.Avalonia.TreeDataGrid.Demo/Program.cs
deleted file mode 100644
index bcf0ebd..0000000
--- a/demo/Semi.Avalonia.TreeDataGrid.Demo/Program.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using System;
-using Avalonia;
-using Avalonia.Media;
-
-namespace Semi.Avalonia.TreeDataGrid.Demo;
-
-sealed class Program
-{
- // Initialization code. Don't use any Avalonia, third-party APIs or any
- // SynchronizationContext-reliant code before AppMain is called: things aren't initialized
- // yet and stuff might break.
- [STAThread]
- public static void Main(string[] args) => BuildAvaloniaApp()
- .With(new FontManagerOptions
- {
- FontFallbacks =
- [
- new FontFallback
- {
- FontFamily = new FontFamily("Microsoft YaHei")
- }
- ]
- })
- .StartWithClassicDesktopLifetime(args);
-
- // Avalonia configuration, don't remove; also used by visual designer.
- public static AppBuilder BuildAvaloniaApp()
- => AppBuilder.Configure()
- .UsePlatformDetect()
- .LogToTrace();
-}
\ No newline at end of file
diff --git a/demo/Semi.Avalonia.TreeDataGrid.Demo/Semi.Avalonia.TreeDataGrid.Demo.csproj b/demo/Semi.Avalonia.TreeDataGrid.Demo/Semi.Avalonia.TreeDataGrid.Demo.csproj
deleted file mode 100644
index 30c4232..0000000
--- a/demo/Semi.Avalonia.TreeDataGrid.Demo/Semi.Avalonia.TreeDataGrid.Demo.csproj
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
- WinExe
- net8.0
- enable
- true
- latest
- app.manifest
- true
-
-
-
-
-
-
-
-
-
-
-
-
- None
- All
-
-
-
-
-
-
-
-
-
diff --git a/demo/Semi.Avalonia.TreeDataGrid.Demo/ViewModels/SongsPageViewModel.cs b/demo/Semi.Avalonia.TreeDataGrid.Demo/ViewModels/SongsPageViewModel.cs
deleted file mode 100644
index 2e91e43..0000000
--- a/demo/Semi.Avalonia.TreeDataGrid.Demo/ViewModels/SongsPageViewModel.cs
+++ /dev/null
@@ -1,184 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using Avalonia.Controls;
-using Avalonia.Controls.Models.TreeDataGrid;
-using CommunityToolkit.Mvvm.ComponentModel;
-
-namespace Semi.Avalonia.TreeDataGrid.Demo.ViewModels;
-
-public class SongsPageViewModel: ObservableObject
-{
- private readonly ObservableCollection _songs;
-
- public FlatTreeDataGridSource Songs { get; }
-
- public SongsPageViewModel()
- {
- _songs = new ObservableCollection(Song.Songs.Select(a => new SongViewModel()
- {
- Title = a.Title, Artist = a.Artist, Album = a.Album, CountOfComment = a.CountOfComment,
- IsSelected = false
- }));
-
- Songs = new FlatTreeDataGridSource(_songs)
- {
- Columns =
- {
- new CheckBoxColumn("IsSelected", a => a.IsSelected,
- (model, b) => { model.IsSelected = b; }, new GridLength(108, GridUnitType.Pixel)),
- new TextColumn("Title", a => a.Title, (o, a) => o.Title = a,
- new GridLength(6, GridUnitType.Star)),
- new TextColumn("Artist", a => a.Artist, (o, a) => o.Artist = a,
- new GridLength(6, GridUnitType.Star)),
- new TemplateColumn("Album", "AlbumCell", "AlbumEditCell",
- new GridLength(6, GridUnitType.Star)),
- new TemplateColumn("Comments", "CommentsCell", "CommentsEditCell",
- new GridLength(6, GridUnitType.Star)),
- }
- };
- }
-
-}
-
-
-public class Song
-{
- public string? Title { get; set; }
- public string? Artist { get; set; }
- public TimeSpan? Duration { get; set; }
- public string? Album { get; set; }
- public int? CountOfComment { get; set; }
- public string Url { get; set; }
-
- public Song(string title, string artist, int m, int s, string album, int countOfComment, int netEaseId)
- {
- Title = title;
- Artist = artist;
- Duration = new TimeSpan(0, m, s);
- Album = album;
- CountOfComment = countOfComment;
- Url = $"https://music.163.com/song?id={netEaseId}";
-
- }
-
- public static List Albums { get; set; } = new List()
- {
- "A.S.I.A",
- "饕餮人间",
- "七步咙咚呛",
- "大惊小怪",
- "The ONE",
- "以梦为马 (壮志骄阳版)",
- "emo了",
- "一眼万年",
- "冲刺吧",
- "爱的赏味期限",
- "COSMIC ANTHEM / 手紙",
- "世界晚安",
- "明年也要好好长大",
- "320万年前",
- "W.O.R.L.D.",
- };
-
- public static List Songs { get; set; } = new List()
- {
- new("好肚有肚(feat.李玲玉)", "熊猫堂ProducePandas", 2, 50, "A.S.I.A", 730, 1487039339),
- new("荒诞秀", "熊猫堂ProducePandas", 3, 15, "A.S.I.A", 639, 1487037601),
- new("长大", "熊猫堂ProducePandas", 4, 6, "A.S.I.A", 1114, 1487037690),
- new("招财猫(feat.纪粹希(G-Tracy))", "熊猫堂ProducePandas", 3, 37, "A.S.I.A", 361, 1487039632),
- new("千转", "熊猫堂ProducePandas", 4, 0, "A.S.I.A", 1115, 1477312398),
- new("辣辣辣", "熊猫堂ProducePandas", 3, 24, "A.S.I.A", 1873, 1465043716),
- new("碎碎念", "熊猫堂ProducePandas", 3, 25, "A.S.I.A", 676, 1474142064),
- new("盘他", "熊猫堂ProducePandas", 2, 16, "A.S.I.A", 365, 1481652786),
- new("Na Na Na", "熊猫堂ProducePandas", 3, 26, "A.S.I.A", 312, 1469022662),
- new("Indigo", "熊猫堂ProducePandas", 3, 15, "A.S.I.A", 137, 1487039517),
- new("饕餮人间", "熊猫堂ProducePandas", 3, 20, "饕餮人间", 1295, 1499584605),
- new("七步咙咚呛", "熊猫堂ProducePandas", 3, 10, "七步咙咚呛", 175, 1809095152),
- new("大惊小怪", "熊猫堂ProducePandas", 3, 32, "大惊小怪", 10420, 1847477425),
- new("工具人", "熊猫堂ProducePandas", 2, 46, "大惊小怪", 1135, 1847476499),
- new("以梦为马", "熊猫堂ProducePandas", 4, 19, "大惊小怪", 18361, 1836034373),
- new("以梦为马(Piano Version)", "熊猫堂ProducePandas", 3, 4, "大惊小怪", 570, 1847477423),
- new("The ONE", "熊猫堂ProducePandas", 2, 58, "The ONE", 1508, 1864329424),
- new("The ONE(日文版)", "熊猫堂ProducePandas", 2, 57, "The ONE", 385, 1864329429),
- new("以梦为马 (壮志骄阳版)", "熊猫堂ProducePandas", 4, 19, "以梦为马 (壮志骄阳版)", 161, 1865138896),
- new("New Horse", "熊猫堂ProducePandas", 2, 30, "emo了", 643, 1887021307),
- new("不例外", "熊猫堂ProducePandas", 3, 31, "emo了", 1818, 1887022665),
- new("满意", "熊猫堂ProducePandas", 4, 32, "emo了", 1081, 1882433472),
- new("就算与全世界为敌也要跟你在一起", "熊猫堂ProducePandas", 3, 32, "emo了", 2119, 1881759960),
- new("The ONE", "熊猫堂ProducePandas", 2, 58, "emo了", 67, 1887022648),
- new("口香糖", "熊猫堂ProducePandas", 3, 10, "emo了", 2181, 1885502254),
- new("Suuuuuuper Mario", "熊猫堂ProducePandas", 3, 32, "emo了", 1010, 1887021318),
- new("饕餮人间", "熊猫堂ProducePandas", 3, 22, "emo了", 109, 1887021320),
- new("以梦为马 (壮志骄阳版)", "熊猫堂ProducePandas", 4, 21, "emo了", 34, 1887022666),
- new("The ONE(日文版)", "熊猫堂ProducePandas", 2, 57, "emo了", 27, 1887022646),
- new("满意(DJheap九天版)", "熊猫堂ProducePandas", 4, 31, "emo了", 31, 1901605941),
- new("一眼万年", "熊猫堂ProducePandas", 3, 54, "一眼万年", 20, 1922599361),
- new("冲刺", "熊猫堂ProducePandas", 3, 49, "冲刺吧", 1006, 1932878194),
- new("滴答滴", "熊猫堂ProducePandas", 2, 30, "爱的赏味期限", 86, 1957515790),
- new("热带季风", "熊猫堂ProducePandas", 2, 45, "爱的赏味期限", 212, 1957514964),
- new("渣", "熊猫堂ProducePandas", 3, 28, "爱的赏味期限", 22, 1957514965),
- new("独特", "熊猫堂ProducePandas", 3, 33, "爱的赏味期限", 62, 1957514966),
- new("雨后", "熊猫堂ProducePandas", 4, 15, "爱的赏味期限", 23, 1957514967),
- new("然后然后", "熊猫堂ProducePandas", 3, 50, "爱的赏味期限", 108, 1957514968),
- new("丢", "熊猫堂ProducePandas", 3, 26, "爱的赏味期限", 30, 1957515792),
- new("热带疾风(FACEVOID桃心连哥 Remix)", "熊猫堂ProducePandas", 3, 23, "爱的赏味期限", 55, 1957515793),
- new("COSMIC ANTHEM -Japanese Ver.-", "熊猫堂ProducePandas", 3, 11, "COSMIC ANTHEM / 手紙", 0, 1977171493),
- new("手紙 (「長大-You Raise Me Up-」-Japanese Ver.-)", "熊猫堂ProducePandas", 4, 11, "COSMIC ANTHEM / 手紙", 0,
- 1977171494),
- new("COSMIC ANTHEM -Chinese Ver.-", "熊猫堂ProducePandas", 3, 31, "COSMIC ANTHEM / 手紙", 0, 1977172202),
- new("世界晚安", "熊猫堂ProducePandas", 2, 59, "世界晚安", 652, 1985063377),
- new("世界晚安(泰文版)", "熊猫堂ProducePandas", 2, 59, "世界晚安", 134, 1987842504),
- new("世界晚安(钢琴版)", "熊猫堂ProducePandas", 3, 2, "世界晚安", 76, 1990475933),
- new("世界晚安(泰文钢琴版)", "熊猫堂ProducePandas", 3, 2, "世界晚安", 29, 1990475934),
- new("世界晚安(DJ沈念版)", "熊猫堂ProducePandas", 3, 9, "世界晚安", 34, 2014263184),
- new("世界晚安(钢琴配乐)", "熊猫堂ProducePandas", 2, 59, "世界晚安", 11, 2014263185),
- new("明年也要好好长大", "熊猫堂ProducePandas", 3, 12, "明年也要好好长大", 0, 2010515162),
- new("320万年前(DJ沈念版)", "熊猫堂ProducePandas", 3, 21, "320万年前", 8, 2055888636),
- new("320万年前", "熊猫堂ProducePandas", 3, 7, "W.O.R.L.D.", 329, 2049770469),
- new("隐德来希", "熊猫堂ProducePandas", 3, 3, "W.O.R.L.D.", 594, 2061317924),
- new("孔明", "熊猫堂ProducePandas", 3, 59, "W.O.R.L.D.", 91, 2063175274),
- new("锦鲤卟噜噜", "熊猫堂ProducePandas", 3, 5, "W.O.R.L.D.", 67, 2059208262),
- new("指鹿为马", "熊猫堂ProducePandas", 3, 12, "W.O.R.L.D.", 74, 2063175272),
- new("热带季风Remix", "熊猫堂ProducePandas", 3, 22, "W.O.R.L.D.", 23, 2063173319),
- new("加州梦境", "熊猫堂ProducePandas", 2, 56, "W.O.R.L.D.", 1662, 2063173324),
- new("渐进自由", "熊猫堂ProducePandas", 4, 19, "W.O.R.L.D.", 124, 2063173321),
- new("世界所有的烂漫", "熊猫堂ProducePandas", 3, 30, "W.O.R.L.D.", 335, 2053388775),
- };
-}
-
-public class SongViewModel: ObservableObject
-{
- private string? _title;
- private string? _artist;
- private string? _album;
- private int? _countOfComment;
- private bool? _isSelected;
- public string? Title
- {
- get => _title;
- set => SetProperty(ref _title, value);
- }
- public string? Artist
- {
- get => _artist;
- set => SetProperty(ref _artist, value);
- }
- public string? Album
- {
- get => _album;
- set => SetProperty(ref _album, value);
- }
- public int? CountOfComment
- {
- get => _countOfComment;
- set => SetProperty(ref _countOfComment, value);
- }
- public bool? IsSelected
- {
- get => _isSelected;
- set => SetProperty(ref _isSelected, value);
- }
-
-}
\ No newline at end of file
diff --git a/demo/Semi.Avalonia.TreeDataGrid.Demo/app.manifest b/demo/Semi.Avalonia.TreeDataGrid.Demo/app.manifest
deleted file mode 100644
index 18ebc37..0000000
--- a/demo/Semi.Avalonia.TreeDataGrid.Demo/app.manifest
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-