Add project files.

This commit is contained in:
2022-08-08 08:01:47 +02:00
parent 6cdc06a98d
commit 3b346b5782
12 changed files with 346 additions and 0 deletions

47
QuickMVVMSetup/MainVM.cs Normal file
View File

@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using System.Windows.Input;
using System.Collections.ObjectModel;
namespace QuickMVVMSetup;
public class MainVM : ChangeNotifier
{
private Person person;
public Person TargetPerson
{
get { return person; }
set { person = value; OnPropertyChanged(nameof(TargetPerson)); }
}
private ObservableCollection<Person> _persons; //only when added/or removed (not for internal property changes)
public ObservableCollection<Person> Persons
{
get { return _persons; }
set { _persons = value; }
}
public void AddPerson(object person)
{
Persons.Add(TargetPerson); // Adding to collection
TargetPerson = new Person(); //Resetting it
}
//public ICommand CMDAdd { get; set; }
public ICommand CMDAdd => new RelayCommand(AddPerson,null);
public MainVM()
{
//CMDAdd = new AddCommand(this);
//TargetPerson = new Person();
Persons = new ObservableCollection<Person>();
}
}