我正在使用 SimpleMVVM 并有两个单独的类(模型),一个使用第二个,如下所示:
public class Database : ModelBase<Database>
{
public String ServerName //{ get; set; }
{
get { return _ServerName; }
set
{
if (_ServerName != value)
{
_ServerName = value;
NotifyPropertyChanged(m => m.ServerName);
}
}
}
private String _ServerName = "MyTestServer";
// other properties removed for brevity
}
public class MyConfiguration
{
/// <summary>
/// Database information
/// </summary>
public Database DatabaseInfo
{
get { return _DatabaseInfo; }
set
{
if (_DatabaseInfo != value)
{
_DatabaseInfo = value;
NotifyPropertyChanged(m => m.DatabaseInfo);
}
}
}
private Database _DatabaseInfo = new Database();
}
'ServerName'
更改时,命令NotifyPropertyChanged(m => m.ServerName);
执行但不执行NotifyPropertyChanged(m => m.DatabaseInfo);
NotifyPropertyChanged(m => m.DatabaseInfo);
每当属性之一发生变化时,我该如何生火Database
?