From 9c014f37be67ee48cf902e66e0f6033a26df93db Mon Sep 17 00:00:00 2001
From: Copilot <198982749+Copilot@users.noreply.github.com>
Date: Wed, 22 Oct 2025 21:01:30 +0800
Subject: [PATCH] Improve Introduction page with condensed layout and 20+
diverse controls (#790)
* Initial plan
* Improve Introduction page with diverse simple controls
Co-authored-by: rabbitism <14807942+rabbitism@users.noreply.github.com>
* Make layout more condensed and add requested controls
- Reduced spacing and padding throughout (20->12 margin, 16->10 padding, 8->6 spacing)
- Reduced section title size (16->14)
- Changed from 2-column to 3-column grid layout for better space utilization
- Added all requested controls: IPv4Box, MultiComboBox, MultiAutoCompleteBox, NumericUpDown, RangeSlider, TagInput, TreeComboBox, DateRangePicker, DateTimePicker, TimeRangePicker, ToolBar, Marquee
- Updated ViewModel with properties for new controls
- Made controls smaller (using Small classes where available)
Co-authored-by: rabbitism <14807942+rabbitism@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rabbitism <14807942+rabbitism@users.noreply.github.com>
---
demo/Ursa.Demo/Pages/IntroductionDemo.axaml | 417 +++++++++---------
.../ViewModels/IntroductionDemoViewModel.cs | 81 ++--
2 files changed, 251 insertions(+), 247 deletions(-)
diff --git a/demo/Ursa.Demo/Pages/IntroductionDemo.axaml b/demo/Ursa.Demo/Pages/IntroductionDemo.axaml
index cfdd29b..2a47850 100644
--- a/demo/Ursa.Demo/Pages/IntroductionDemo.axaml
+++ b/demo/Ursa.Demo/Pages/IntroductionDemo.axaml
@@ -6,6 +6,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:u="https://irihi.tech/ursa"
xmlns:vm="using:Ursa.Demo.ViewModels"
+ xmlns:models="clr-namespace:Ursa.Demo.Models"
x:DataType="vm:IntroductionDemoViewModel"
d:DesignHeight="800"
d:DesignWidth="1600"
@@ -13,225 +14,235 @@
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
- 2.4k
-
-
-
-
-
- 2.4k
-
-
-
-
-
- 2.4k
-
-
-
-
-
- 2.4k
-
-
+
+
+
+ 1.0
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
- Stretch
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/demo/Ursa.Demo/ViewModels/IntroductionDemoViewModel.cs b/demo/Ursa.Demo/ViewModels/IntroductionDemoViewModel.cs
index 66ced6d..56d2f35 100644
--- a/demo/Ursa.Demo/ViewModels/IntroductionDemoViewModel.cs
+++ b/demo/Ursa.Demo/ViewModels/IntroductionDemoViewModel.cs
@@ -2,59 +2,52 @@ using System;
using System.Collections.ObjectModel;
using System.Net;
using CommunityToolkit.Mvvm.ComponentModel;
+using Ursa.Demo.Models;
namespace Ursa.Demo.ViewModels;
public partial class IntroductionDemoViewModel : ObservableObject
{
- public ObservableCollection MenuItems { get; set; } = new()
- {
- new MenuItemViewModel()
- {
- MenuHeader = "任务管理",
- MenuIconName = "User",
- Children = new ObservableCollection()
- {
- new()
- {
- MenuHeader = "公告管理",
- MenuIconName = "Star",
- Children = new ObservableCollection()
- {
- new() { MenuHeader = "公告设置" },
- new() { MenuHeader = "公告处理" }
- }
- },
- new() { MenuHeader = "任务查询" }
- }
- },
- new MenuItemViewModel()
- {
- MenuHeader = "附加功能",
- IsSeparator = true,
- },
- new MenuItemViewModel()
- {
- MenuHeader = "任务平台",
- MenuIconName = "Gear",
- Children = new ObservableCollection()
- {
- new() { MenuHeader = "任务管理" },
- new() { MenuHeader = "用户任务查询" }
- }
- }
- };
-
public ObservableCollection ButtonGroupItems { get; set; } = new()
{
"Avalonia", "WPF", "Xamarin"
};
- [ObservableProperty] private IPAddress? _address;
-
- public void ChangeAddress()
+ public ObservableCollection ComboBoxItems { get; set; } = new()
{
- long l = Random.Shared.NextInt64(0x00000000FFFFFFFF);
- Address = new IPAddress(l);
- }
+ "Option 1", "Option 2", "Option 3", "Option 4", "Option 5"
+ };
+
+ public ObservableCollection AutoCompleteItems { get; set; } = new()
+ {
+ new() { MenuHeader = "Avatar", Chinese = "头像" },
+ new() { MenuHeader = "Badge", Chinese = "徽标" },
+ new() { MenuHeader = "Button", Chinese = "按钮" },
+ new() { MenuHeader = "Dialog", Chinese = "对话框" },
+ };
+
+ public ObservableCollection TagItems { get; set; } = new()
+ {
+ "Tag1", "Tag2", "Tag3"
+ };
+
+ [ObservableProperty] private double _ratingValue = 3.5;
+
+ [ObservableProperty] private int _sliderValue = 50;
+
+ [ObservableProperty] private IPAddress? _ipAddress = new IPAddress(new byte[] { 192, 168, 1, 1 });
+
+ [ObservableProperty] private double _lowerValue = 20;
+
+ [ObservableProperty] private double _upperValue = 80;
+
+ [ObservableProperty] private DateTime _startDate = DateTime.Today;
+
+ [ObservableProperty] private DateTime _endDate = DateTime.Today.AddDays(7);
+
+ [ObservableProperty] private DateTime _dateTime = DateTime.Now;
+
+ [ObservableProperty] private TimeSpan _startTime = new TimeSpan(9, 0, 0);
+
+ [ObservableProperty] private TimeSpan _endTime = new TimeSpan(17, 0, 0);
}
\ No newline at end of file