Merge pull request #221 from irihitech/combotree

TreeComboBox
This commit is contained in:
Zhang Dian
2024-04-23 23:45:46 +08:00
committed by GitHub
11 changed files with 927 additions and 1 deletions

View File

@@ -56,6 +56,7 @@ public class MainViewViewModel : ViewModelBase
MenuKeys.MenuKeySkeleton => new SkeletonDemoViewModel(),
MenuKeys.MenuKeyTagInput => new TagInputDemoViewModel(),
MenuKeys.MenuKeyTimeline => new TimelineDemoViewModel(),
MenuKeys.MenuKeyTreeComboBox => new TreeComboBoxDemoViewModel(),
MenuKeys.MenuKeyTwoTonePathIcon => new TwoTonePathIconDemoViewModel(),
MenuKeys.MenuKeyThemeToggler => new ThemeTogglerDemoViewModel(),
MenuKeys.MenuKeyToolBar => new ToolBarDemoViewModel(),

View File

@@ -44,6 +44,7 @@ public class MenuViewModel: ViewModelBase
new() { MenuHeader = "TagInput", Key = MenuKeys.MenuKeyTagInput },
new() { MenuHeader = "Theme Toggler", Key = MenuKeys.MenuKeyThemeToggler },
new() { MenuHeader = "Timeline", Key = MenuKeys.MenuKeyTimeline },
new() { MenuHeader = "TreeComboBox", Key = MenuKeys.MenuKeyTreeComboBox },
new() { MenuHeader = "TwoTonePathIcon", Key = MenuKeys.MenuKeyTwoTonePathIcon},
new() { MenuHeader = "ToolBar", Key = MenuKeys.MenuKeyToolBar },
new() { MenuHeader = "Time Box", Key = MenuKeys.MenuKeyTimeBox, Status = "New" },
@@ -88,6 +89,7 @@ public static class MenuKeys
public const string MenuKeyTimeline = "Timeline";
public const string MenuKeyTwoTonePathIcon = "TwoTonePathIcon";
public const string MenuKeyThemeToggler = "ThemeToggler";
public const string MenuKeyTreeComboBox = "TreeComboBox";
public const string MenuKeyToolBar = "ToolBar";
public const string MenuKeyVerificationCode = "VerificationCode";
public const string MenuKeyTimeBox = "TimeBox";

View File

@@ -0,0 +1,68 @@
using System.Collections.Generic;
using CommunityToolkit.Mvvm.ComponentModel;
namespace Ursa.Demo.ViewModels;
public partial class TreeComboBoxDemoViewModel: ObservableObject
{
[ObservableProperty] private TreeComboBoxItemViewModel? _selectedItem;
public List<TreeComboBoxItemViewModel> Items { get; set; }
public TreeComboBoxDemoViewModel()
{
Items = new List<TreeComboBoxItemViewModel>()
{
new TreeComboBoxItemViewModel()
{
ItemName = "Item 1",
Children = new List<TreeComboBoxItemViewModel>()
{
new TreeComboBoxItemViewModel()
{
ItemName = "Item 1-1",
Children = new List<TreeComboBoxItemViewModel>()
{
new TreeComboBoxItemViewModel()
{
ItemName = "Item 1-1-1"
},
new TreeComboBoxItemViewModel()
{
ItemName = "Item 1-1-2"
}
}
},
new TreeComboBoxItemViewModel()
{
ItemName = "Item 1-2"
}
}
},
new TreeComboBoxItemViewModel()
{
ItemName = "Item 2",
Children = new List<TreeComboBoxItemViewModel>()
{
new TreeComboBoxItemViewModel()
{
ItemName = "Item 2-1"
},
new TreeComboBoxItemViewModel()
{
ItemName = "Item 2-2"
}
}
},
new TreeComboBoxItemViewModel()
{
ItemName = "Item 3"
},
};
}
}
public partial class TreeComboBoxItemViewModel : ObservableObject
{
[ObservableProperty] private string? _itemName;
public List<TreeComboBoxItemViewModel> Children { get; set; } = new ();
}