public void AddInspectorControls( InspectorType typeInfo, Panel panel, GetPropertyValueDelegate getPropertyValue, InspectorControlValueChangedDelegate onValueChanged, bool addNameLabel = true) { if (addNameLabel) { // Add label for component name. var componentName = typeInfo.Type.Name; componentName = componentName.Replace("Component", string.Empty); componentName = componentName.SplitByCapitalLetters(); Label componentLabel = new Label { Content = componentName, ToolTip = typeInfo.Description, FontWeight = FontWeights.Bold }; panel.Children.Add(componentLabel); } // Add inspectors for component properties. foreach (var inspectorProperty in typeInfo.Properties) { // Get current value. bool inherited = true; var propertyValue = getPropertyValue != null ? getPropertyValue(inspectorProperty, out inherited) : inspectorProperty.Default; // Create control for inspector property. IInspectorControl propertyControl = this.CreateInspectorControlFor( inspectorProperty, propertyValue, inherited); if (propertyControl == null) { continue; } if (onValueChanged != null) { // Subscribe for change of value. propertyControl.ValueChanged += onValueChanged; } // Create wrapper. InspectorWithLabel inspectorWrapper = new InspectorWithLabel { DataContext = ((FrameworkElement)propertyControl).DataContext, Control = propertyControl }; // Add to panel. panel.Children.Add(inspectorWrapper); } }