22 lines
497 B
C#
22 lines
497 B
C#
using System.Diagnostics.Metrics;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using CommunityToolkit.Mvvm.Input;
|
|
|
|
namespace VisionBuilder.UI.Common;
|
|
|
|
public partial class ExampleMainViewModel : ObservableObject
|
|
{
|
|
|
|
[ObservableProperty]
|
|
[NotifyCanExecuteChangedFor(nameof(IncrementCommand))]
|
|
private int _counter;
|
|
|
|
[RelayCommand(CanExecute = nameof(CanIncrement))]
|
|
private void Increment()
|
|
{
|
|
Counter++;
|
|
}
|
|
|
|
private bool CanIncrement => this.Counter < 10;
|
|
}
|