-
Notifications
You must be signed in to change notification settings - Fork 22
t01Mvvm
Alex chow edited this page Apr 3, 2022
·
2 revisions
dotnet new console -o t01Mvvm dotnet add t01Mvvm package CommunityToolkit.Mvvm dotnet sln add t01Mvvm/t01Mvvm.csproj
var model = new testEntity();
model.PropertyChanged += (s, e) => { Console.WriteLine("changing " + e.PropertyName); }; model.Vers = 1; model.Vers = 111; model.Vers = 133;
[ObservableObject]
public partial class testEntity
{
public string SaveAI(string x)
{
Console.WriteLine("SaveAI " + x);
return x;
}
public string FullName{
set {
Console.WriteLine("SaveAI2 ");
System.IO.File.WriteAllText("12345.txt", "12344");
}
}
[ObservableProperty]
[AlsoNotifyChangeFor(nameof(FullName))]
[NonSerialized]
int vers;
public int Ver { get => ver; set { SetProperty(ver, value, callback: (x) => SaveAI(x.ToString())); } }
int ver = 0;
}
FreeSql QQ群:4336577(已满)、8578575(已满)、52508226(在线)
BA & Blazor QQ群:795206915、675147445
本作品采用 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议 进行许可。欢迎转载、使用、重新发布,但务必保留文章署名AlexChow(包含链接: https://github.com/densen2014 ),不得用于商业目的,基于本文修改后的作品务必以相同的许可发布。如有任何疑问,请与我联系 。