public void Add(GeneralObject item)
{
item.List = this;
//不需要空行处理,直接添加,否则,添加到空行前面
if (EmptyRow == null || item == EmptyRow)
{
objects.Add(item);
//OnPropertyChanged("Count");
}
else
{
int index = objects.IndexOf(EmptyRow);
objects.Insert(index, item);
}
Monity(item);
item.MonityList();
//新加对象取列表的PropertySetter
foreach (PropertySetter ps in this.PropertySetters)
{
PropertySetter nps = ps.Clone();
nps.Object = item;
item.PropertySetters.Add(nps);
//对ps中的每一个表达式,复制出一份
foreach (Exp exp in ps.Exps)
{
Exp nexp = exp.Clone();
nexp._targetObject = nps;
//触发nps的Loaded事件,让新表达式开始解析
nexp.OnLoaded(nps, new RoutedEventArgs());
}
}
}