优化更新
This commit is contained in:
71
WPFUIAPP/ViewModel2.cs
Normal file
71
WPFUIAPP/ViewModel2.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
namespace WPFUIAPP;
|
||||
public partial class ViewModel2 : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private TreeModelCollection<TreeTestModel> treeTestModel = CreateTestModel();
|
||||
|
||||
public static TreeModelCollection<TreeTestModel> CreateTestModel()
|
||||
{
|
||||
return new TreeModelCollection<TreeTestModel>()
|
||||
{
|
||||
Children = new(
|
||||
[
|
||||
new()
|
||||
{
|
||||
Column1 = "Test 1",
|
||||
Column2 = "Test 1",
|
||||
Column3 = "Test 1",
|
||||
Children = new(
|
||||
[
|
||||
new()
|
||||
{
|
||||
Column1 = "Test 1.1",
|
||||
Column2 = "Test 1.1",
|
||||
Column3 = "Test 1.1",
|
||||
Children = new(
|
||||
[
|
||||
new()
|
||||
{
|
||||
Column1 = "Test 1.2",
|
||||
Column2 = "Test 1.2",
|
||||
Column3 = "Test 1.2",
|
||||
},
|
||||
]),
|
||||
},
|
||||
]),
|
||||
},
|
||||
new()
|
||||
{
|
||||
Column1 = "Test 2",
|
||||
Column2 = "Test 2",
|
||||
Column3 = "Test 2",
|
||||
}
|
||||
]),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
[ObservableObject]
|
||||
public partial class TreeTestModel : TreeModelObject<TreeTestModel>
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string? column1;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? column2;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? column3;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool isChecked = false;
|
||||
}
|
||||
Reference in New Issue
Block a user