change to mvvm Community Toolkit programing pattern

master
Yik Teng Hie 3 years ago
parent de981433d2
commit d3b87a10a3

@ -1,26 +1,21 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MvvmCommunityApp.viewmodels
{
public class MainWindowViewModel : ObservableObject
public partial class MainWindowViewModel : ObservableObject
{
public string Title { get; set; }
public RelayCommand AddCommand { get; }
public MainWindowViewModel()
public MainWindowViewModel()
{
Title = "MyIocName";
//
AddCommand = new RelayCommand(DoAdd);
}
private void DoAdd()
[RelayCommand]
private void Add()
{
Console.WriteLine("Do Add");
}

Loading…
Cancel
Save