我正在使用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);
。如何使
Database
的属性更改时,NotifyPropertyChanged(m => m.DatabaseInfo);
命令触发?