add:Maybe we can add a command demo here to show how to trigger the bound command. change:I think these two themes should be merged, and the "AcceptReturn" should just be controlled by "AllowMultiple" add:One more thing, we should add a property to control what to do when user cancelled a selection. Sometimes I just want to keep the original selection.
18 lines
507 B
C#
18 lines
507 B
C#
using System.Collections.Generic;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using CommunityToolkit.Mvvm.Input;
|
|
|
|
namespace Ursa.Demo.ViewModels;
|
|
|
|
public partial class PathPickerDemoViewModel : ViewModelBase
|
|
{
|
|
[ObservableProperty] private string? _path;
|
|
[ObservableProperty] private IReadOnlyList<string>? _paths;
|
|
[ObservableProperty] private int _commandTriggerCount = 0;
|
|
|
|
[RelayCommand]
|
|
private void Selected(IReadOnlyList<string> paths)
|
|
{
|
|
CommandTriggerCount++;
|
|
}
|
|
} |