Files
Ursa.Avalonia/demo/Ursa.Demo/ViewModels/DescriptionsDemoViewModel.cs
Dong Bin dcaef1c8ed [New Control] Descriptions (#791)
* feat: add ColumnWrapPanel.

* feat: add Descriptions and DescriptionsItem controls

* WIP: extract a LabeledContentControl for this particular need.

* wip.

* feat: setup demo. fix various initial status issue.

* fix: fix a layout issue.

* feat: improve demo.

* feat: update demo.

* fix: remove a redundant calculation.

* feat: update per copilot feedback.

* feat: add tests, fix a calculation issue.

* feat: refactor to change the default label and value binding assignment logic.

* feat: introduce orientation.

* misc: format codes.

* feat: clarify LabelPosition property.

* feat: extract Font resources.

* revert AvatarDemo.

* feat: assign specific value to Font resources for testing.

* misc: resolve copilot comment.

---------

Co-authored-by: Zhang Dian <54255897+zdpcdt@users.noreply.github.com>
2025-10-22 20:49:02 +08:00

38 lines
1.7 KiB
C#

using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
namespace Ursa.Demo.ViewModels;
public partial class DescriptionsDemoViewModel : ObservableObject
{
public ObservableCollection<DescriptionItemViewModel> Items { get; set; }
public ObservableCollection<DescriptionItemViewModel> Items2 { get; set; }
public DescriptionsDemoViewModel()
{
Items = new ObservableCollection<DescriptionItemViewModel>()
{
new() { Label = "Actual Users", Description = "1,480,000" },
new() { Label = "7-day Retention", Description = "98%" },
new() { Label = "Security Level", Description = "III" },
new() { Label = "Category Tag", Description = "E-commerce" },
new() { Label = "Authorized State", Description = "Unauthorized" },
};
Items2 = new ObservableCollection<DescriptionItemViewModel>()
{
new() { Label = "抖音号", Description = "SemiDesign" },
new() { Label = "主播类型", Description = "自由主播" },
new() { Label = "安全等级", Description = "3级" },
new() { Label = "垂类标签", Description = "编程" },
new() { Label = "作品数量", Description = "88888888" },
new() { Label = "认证状态", Description = "这是一个很长很长很长很长很长很长很长很长很长的值" },
new() { Label = "上次直播时间", Description = "2024-05-01 12:00:00" }
};
}
}
public partial class DescriptionItemViewModel : ObservableObject
{
[ObservableProperty] private string? _label;
[ObservableProperty] private object? _description;
}