private static void OnSelectedEntityChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { XbimTreeview view = d as XbimTreeview; if (view != null && e.NewValue is IPersistEntity) { view.UnselectAll(); IPersistEntity newVal = (IPersistEntity)(e.NewValue); if (newVal != null) { view.Select(newVal); } } }
private static void OnModelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { XbimTreeview tv = d as XbimTreeview; var model = e.NewValue as IfcStore; if (tv != null && model != null) { //TODO resolve reference models //model.ReferencedModels.CollectionChanged += tv.RefencedModels_CollectionChanged; switch (tv.ViewDefinition) { case XbimViewType.SpatialStructure: tv.ViewModel(); break; case XbimViewType.Classification: break; case XbimViewType.Materials: break; case XbimViewType.IfcEntityType: break; case XbimViewType.Groups: tv.ViewGroups(); break; } } else { if (tv != null) //unbind { tv.UnselectAll(); tv.HierarchySource = Enumerable.Empty <XbimModelViewModel>(); } } }