mirror of
https://github.com/PacktPublishing/Learn-WinUI-3-Second-Edition.git
synced 2026-06-20 12:23:09 +00:00
32 lines
732 B
C#
32 lines
732 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace WinUI3.SimpleSample
|
|
{
|
|
public class MainViewModel : INotifyPropertyChanged
|
|
{
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
private string _name;
|
|
|
|
public MainViewModel()
|
|
{
|
|
_name = "Bob Jones";
|
|
}
|
|
|
|
public string Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
if (_name == value) return;
|
|
_name = value;
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Name)));
|
|
}
|
|
}
|
|
}
|
|
}
|