private CategoryContainer GetComponentCategoryContainer(IInspectableComponent component, string headerText) { string uniqueId = component.GetHashCode().ToString(); if (categoryViews.ContainsKey(uniqueId)) { return(categoryViews[uniqueId]); } CategoryContainer newCategory = new CategoryContainer(); ComponentCategoryHeader header = new ComponentCategoryHeader(); header.Header = headerText; header.RemoveClicked += () => { ComponentRemoved(component); }; newCategory.Header = header; categoryViews.Add(uniqueId, newCategory); CategoryPanel.Children.Add(newCategory); return(newCategory); }
private void AddInspectableComponent(IInspectableComponent component) { InspectableProperty[] properties = component.Properties; //Add Container independently of any properties ComponentDescriptor descriptor = ComponentDescriptorCache.GetDescriptor(component); CategoryContainer container = null; if (descriptor.Removable) { container = GetComponentCategoryContainer(component, descriptor.Title); } else { container = GetDefaultHeaderCategoryContainer(descriptor.Title); } foreach (InspectableProperty property in properties) { InspectablePropertyMetadata propertyMetadata = DefaultPropertyFactory.GetPropertyMetadata(property); ListenToPropertyChanged(property); AddProperty(property, propertyMetadata, container); } }
private void ComponentRemoved(IInspectableComponent component) { (SelectedObject as IComponentContainer)?.ComponentRemoved(component); }
private void ComponentContainer_ComponentAdded(IInspectableComponent component) { AddInspectableComponent(component); }
public static ComponentDescriptor GetDescriptor(IInspectableComponent component) { return(GetDescriptor(component.GetType())); }
public void ComponentRemoved(IInspectableComponent component) { throw new NotImplementedException(); }