mirror of
https://github.com/jie65535/Helpers.git
synced 2025-06-01 17:29:12 +08:00
31 lines
675 B
C#
31 lines
675 B
C#
using System.Windows.Input;
|
|
|
|
using GalaSoft.MvvmLight;
|
|
using GalaSoft.MvvmLight.Command;
|
|
|
|
namespace MvvmLightDemo.ViewModel
|
|
{
|
|
public class MainViewModel : ViewModelBase
|
|
{
|
|
private string _Title;
|
|
|
|
public string Title
|
|
{
|
|
get => _Title;
|
|
set => Set(ref _Title, value);
|
|
}
|
|
|
|
public ICommand ChangeTitleCommand { get; set; }
|
|
|
|
public MainViewModel()
|
|
{
|
|
Title = "Hello World!";
|
|
ChangeTitleCommand = new RelayCommand(ChangeTitle);
|
|
}
|
|
|
|
private void ChangeTitle()
|
|
{
|
|
Title = "Hello MvvmLight!";
|
|
}
|
|
}
|
|
} |