public void OnItemSourceChanged(IList oldValue, IList newValue) { m_listType = null; Type oldType = oldValue != null?oldValue.GetType() : null; var oldListType = oldType != null?oldType.GetGenericArguments()[0].GetGenericArguments()[0] : null; if (newValue != null) { Items.Clear(); foreach (IList item in newValue) { Items.Add((IList)CreateClone(item)); } Type type = newValue.GetType(); m_listType = type.GetGenericArguments()[0].GetGenericArguments()[0]; if (!NewItemTypes.Contains(m_listType)) { NewItemTypes.Insert(0, m_listType); } if (oldListType != null && m_listType != oldListType && !m_listType.IsSubclassOf(oldListType)) { NewItemTypes.Remove(oldListType); } } }
protected virtual void ItemsSourceTypeChanged(Type oldValue, Type newValue) { Type listType = GetListItemType(newValue); if (!NewItemTypes.Contains(listType)) { NewItemTypes.Add(listType); } }