Skip to content

Instantly share code, notes, and snippets.

@hilapon
Last active April 25, 2022 05:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hilapon/95cdd933a3afc440bec3b162adeca950 to your computer and use it in GitHub Desktop.
Save hilapon/95cdd933a3afc440bec3b162adeca950 to your computer and use it in GitHub Desktop.
ビューモデルをプロジェクトに追加
using System.ComponentModel;
namespace MauiApp1 {
internal class MainViewModel : INotifyPropertyChanged {
public event PropertyChangedEventHandler PropertyChanged;
#region プロパティ
private string _CounterText;
public string CounterText {
get => _CounterText;
private set {
if (_CounterText == value) return;
_CounterText = value;
OnPropertyChanged(nameof(CounterText));
}
}
#endregion
protected virtual void OnPropertyChanged(string propertyName) {
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment