Files
Ursa.Avalonia/demo/Ursa.Demo/ViewModels/ButtonGroupDemoViewModel.cs
Dong Bin a4906d5130 Fix wasm deployment issue (#827)
* fix: update wasm-tools installation

* fix: add TrimmerRootAssembly for WASM optimization

* fix: update project to target .NET 10 and adjust deployment settings

* fix: add TrimmerRootAssembly for Ursa.Demo to improve WASM optimization

* fix: avoid Window based dialog crash on non-supported platforms.
2025-11-17 11:24:07 +08:00

35 lines
854 B
C#

using System.Collections.ObjectModel;
using System.Threading.Tasks;
using System.Windows.Input;
using CommunityToolkit.Mvvm.Input;
using Ursa.Controls;
namespace Ursa.Demo.ViewModels;
public class ButtonGroupDemoViewModel: ViewModelBase
{
public ObservableCollection<ButtonItem> Items { get; set; } = new ()
{
new ButtonItem(){Name = "Ding" },
new ButtonItem(){Name = "Otter" },
new ButtonItem(){Name = "Husky" },
new ButtonItem(){Name = "Mr. 17" },
new ButtonItem(){Name = "Cass" },
};
}
public class ButtonItem
{
public string? Name { get; set; }
public ICommand InvokeCommand { get; set; }
public ButtonItem()
{
InvokeCommand = new AsyncRelayCommand(Invoke);
}
private async Task Invoke()
{
await MessageBox.ShowOverlayAsync("Hello " + Name);
}
}